With an EditText it is possible to add an entry to support alphanumeric digits like the following:
android:digits="@string/alphanumeric_allowed_chars_free_textentry"
Where the string is defined as
<string name="alphanumeric_allowed_chars_free_textentry">
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=[];,./~!@#$%^</string>
However, as others have noted, when a user sets the digits
attribute, it can cause the "enter" button to show a return arrow instead of a next
or done
button, as described in this related question
The typical solution to get done
to show up is to set android:singleLine="true"
and android:imeOptions="actionDone"
, but this will only work for an input box which is not a multi-line box. I have a multi-line edit text and would like to be able to add a done
button and also fliter using the digits
attribute.
Does anyone know how to allow an EditText to use digits while also being multiline, while also allowing the return button to show "done"? Android 4.4