Reputation: 2823
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
.
Upvotes: 8
Views: 1944
Reputation: 2823
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.
Upvotes: 7