I am setting (programmatically) the input type of several EditText that way, so keyboard with only numbers pops up to the user. But it is not working, the normal keyboard, with letters, appears. If I set them to setInputType(InputType.TYPE_CLASS_NUMBER) appears the keyboard I want, but I am not able to set a decimal value. Dot simply doesn't appear. I tried with setRawInputType, but it does not work neither. i was not able to find a question here in SO regarding that issue.
Is that a bug, or something I am not doing well? How could I show the numeric keyboard, and be able to assign a decimal value?
As a side note, i am using an Experia M2 to try.
Thank you.
Found the solution, you need to set BOTH types:
Java:
editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
Kotlin:
editText.inputType = InputType.TYPE_CLASS_NUMBER or InputType.TYPE_NUMBER_FLAG_DECIMAL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With