In my application I have an EditText
.
This EditText
is for currency input, for example: 2.23
, 9.99
In other words user can type 2
then .
then 23
to this EditText
To achieve this behavior of EditText
I implemented an InputFilter
like in Mussa's answer of this question EditText with Currency format. And it worked like a charm.
But then I wanted to replace my EditText
by construction like this:
<android.support.design.widget.TextInputLayout
android:id="@+id/secondary_currency"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/main_currency"
tools:hint="Болгарский перец">
<android.support.design.widget.TextInputEditText
android:id="@+id/secondary_currency_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
android:textSize="12sp"
tools:text="348929.00" />
</android.support.design.widget.TextInputLayout>
Now, I apply my InputFilter
to the TextInputEditText
.
I was surprised when I didn't manage to type .
after 2
.
Why I can't to type dot in case of TextInputEditText
? How to achieve it?
With the current layout code. I can see that you have used inputType
as number
and your desirable has to be decimal.
You can try with inputType
as numberDecimal
.
Hope it helps.