My Activity
has an EditText
as defined bellow:
<EditText
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:digits="0123456789.:"
/>
The allowed input should be .
, :
and numbers
. But if a not allowed char is typed when the EditText
is empty the text starts to be duplicated.
For example, assuming the EditText
is empty, type the following sequence: abc123
.
On my device the result is 1112123
, but the expected result should be just 123
.
As this should be as simple as possible, I would not like to use an InputFilter
.
In fact this has something to do with the default InputFilter
for android:digits
(DigitsKeyListener), the android:inputType="text"
and the current Keyboard
.
The keyboard suggestions can be messy when using android:digits
. As I do not need keyboard suggestions for this specific EditText
I changed the android:inputType
to textNoSuggestions
and now it is working as expected.
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