Reputation: 5356
I have an android app that uses an EditText with android:inputType="number"
when the edittext first displays the softkeyboard appears with only numerics enabled (you can still see the other keys though.
The EditText also has android:digits="0123456789\n"
as I want the users to be able to enter multiple lines
As soon as I hit the ENTER key to create another line the numeric keys disappear.
How can I...
a). Only show a numeric keyboard (with Enter key) e.g. just 0123456789?
b). Stop the softkeyboard showing all the other keys?
Upvotes: 2
Views: 1198
Reputation: 206
Try this
editTextField.setRawInputType(Configuration.KEYBOARD_QWERTY);
This shows the normal key pad with the numeric version first, yet allows you to switch between them.
getInput.setRawInputType(Configuration.KEYBOARD_12KEY);
Upvotes: 0
Reputation: 4971
You want a multiline EditText
and numeric keyboard? Seems possible, but deprecated. Check out this answer.
Update: If everything fails, try to enforce the numeric type every time a line break is inserted:
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
Upvotes: 2
Reputation: 5356
Found a solution
by employing
android:digits="0123456789\n"
android:inputType="phone|textMultiLine"
I obtain the desired effect.
Upvotes: 1