开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜