CarlosMacMar
CarlosMacMar

Reputation: 258

EditText numberDecimal but keyboard appears

I'm trying to use an EditText to only receive decimals, and it work's, but only in android emulator. In my Xiaomi (MIUI optimization disabled), the first time I click on it, normal keyboard appears (but I can't write anything), and the second time, numeric keyboard appears and now I'm able to use it the right way. This is the code for the EditText:

<EditText
        android:id="@+id/et_cambio"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:ems="10"
        android:digits="0123456789."
        android:inputType="numberDecimal"
        android:textAlignment="center" />

Any thoughts on what can be happening? Thank you so much :)

Upvotes: 2

Views: 544

Answers (1)

Rainmaker
Rainmaker

Reputation: 11090

Try putting this line in your Manifest for Activity where you have EditText

<activity
    android:windowSoftInputMode="stateHidden|adjustNothing">
</activity>

Upvotes: 1

Related Questions