Input Type Number, no negative sign or decimals allowed?
I have two edittext views that 开发者_StackOverflowI using for a calculation and both need to be limited to numbers only so I'm using the InputType to do this, but now I cannot enter a negative number or any numbers containing decimals!
Any ideas or solutions?
Thanks!
You should use numberSigned
or numberDecimal
, or both numberDecimal|numberSigned
to enable features you need.
Simply use the below and even the device input keyboard will contain numbers only:
myTextView.setInputType(
InputType.TYPE_CLASS_NUMBER);
精彩评论