开发者

Input Type Number, no negative sign or decimals allowed?

开发者 https://www.devze.com 2023-03-26 18:05 出处:网络
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 numbe

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

精彩评论

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