Domanda

I have an EditText in my app that a user can enter a decimal Volume in.

At the moment i use:

EditText editTextVolume = (EditText)findViewById(R.id.edit_vol);
editTextVolume.setInputType(InputType.TYPE_CLASS_NUMBER|InputType.TYPE_NUMBER_FLAG_DECIMAL); 

to get a numerical keypad. Is there anyway I can have this same keypad but with an extra button that is * or x so i can allow the user to input for example 4x200.

I only want that one multiplication character (so no divide or other mathematical operators)

Is this possible?

È stato utile?

Soluzione

Not possible without implementing your own custom keypad.

However, if your project requirements are not very strict, you may use InputType.TYPE_CLASS_PHONE. This will allow putting * symbol, but will also make available several other symbols (e.g., #, +, ., ,) used in phone numbers.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top