I have an EditText which simply should disallow typing specific letters. I have made a variable string with the accepted digits as follows: <string name="accepted_digits">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&-,\'</string>
My EditText looks like this:
<EditText
android:id="@+id/test_editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:digits="@string/accepted_digits"
/>
Now when I type an accepted digit followed by any digit not in the accepted_digits
string it produces a weird behaviour i.e
1st input = M
| Displayed: M
2nd input = æ
| Displayed: MM
3rd input = l
| Displayed: MMMlMl
4th input = k
| Displayed: MMMlMlMlk
I did not intend this behaviour - I intended that an unaccepted digit would simply be skipped so my displayed input would be: Mlk
.
I have tried simply changing the inputType to android:inputType="textVisiblePassword
but I would like autosuggestion to be allowed.
Any help is appreciated.