Reputation: 380
I have an EditText with inputType numberDecimal
, so it should allow insertion of decimal values, like 4.2, 3.14 etc. But it doesn't allow me to insert values < 1.0, it's impossible to write 0.something, because the number doesn't appear in the EditText. The text simply cannot start with "0" for some reason.
How do I allow user to write any number larger or equal 0.0?
Tested on Android 7.0.1
EditText XML:
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxEms="10"
android:layout_gravity="center"
android:inputType="numberDecimal"
android:textSize="16dp"
android:digits="0123456789." />
Upvotes: 1
Views: 1524
Reputation: 156
The following seems to be working for me.
<EditText
android:id="@+id/buyET"
android:layout_width="150dp"
android:layout_height="45dp"
android:ems="10"
android:inputType="numberDecimal" />
For you it would look some thing like this:
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ems="10"
android:layout_gravity="center"
android:inputType="numberDecimal"
android:textSize="16dp" />
Upvotes: 1