使 EditText 对象仅接受数值
我想在这个属性中以编程方式创建一个 EditText:
android:inputType="number|numberSigned|numberDecimal"
简而言之,我希望它只接受数字值。我该如何设置我的 EditText 对象?
I'd like to create programatically an EditText within this attribute:
android:inputType="number|numberSigned|numberDecimal"
In brief I'd like it to accept only numeric values. How do I have to set my EditText object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
inputType对应的方法是
public void setInputType (int type)
所以像下面这样的东西应该可以工作(未经测试)
The corresponding method for inputType is
public void setInputType (int type)
So something like the below should work (untested)