On the soft keyboard in Android you can set the soft keyboard to show the numbers instead of a-z keyboard using android:inputType="numberDecimal"
. However, what do I do if I only want to show the top number row 1 2 3 4 5 6 7 8 9 0
and not the following rows starting with @ # $ % ...
?
Thanx for listening!
You must only add this line on your code:
this will show only the numeric keyboard.
Last I looked into it, Android did not have any good options for that. I ended up having to write my own version of a soft keyboard-like user interface.
The phone number pad is the closest thing I've found (set
inputType="phone"
on yourEditText
).The accepted answer did not work for me (tested on OnePlus 3t and Samsung Galaxy S6/S7 phones).
This solution uses numberPassword but overrides the default transformation method for the EditText to show characters instead of showing dots.
is an option
Just posted an answer here but re-posting for simplicity:
Seems Android has added the functionality we were seeking. This is the xml I use for simple EditText numeric entry: