Input type number, no negative or decimal?

I have two kinds of edittext that I use to calculate, and both of them should be limited by numbers, so I use InputType for this, but now I can not enter a negative number or any numbers containing decimal places!

Any ideas or solutions?

Thanks!

+4
source share
2 answers

You must use numberSigned or numberDecimal , or both numberDecimal|numberSigned , to enable the necessary functions.

+5
source

Just use below and even the device input keyboard will only contain numbers:

 myTextView.setInputType( InputType.TYPE_CLASS_NUMBER); 
0
source

All Articles