Search code examples
androidandroid-edittextdecimal

Configure android EditText to allow decimals and negatives


I have an Android EditText that I want to have the number keyboard come up.

If I set the android:inputType to numberSigned, I get the number keyboard and the ability to type in negatives. However this won't let me use decimals. If I use the numberDecimal inputType I can use decimals but not negatives.

How do you get the number keyboard with the ability to type in decimals and negatives?


Solution

  • You are just missing this in your EditText,

    android:inputType="numberDecimal|numberSigned"