开发者

Making an EditText object accept only numeric values

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开发者_StackOverflow社区 do I have to set my EditText object?


The corresponding method for inputType is

public void setInputType (int type)

So something like the below should work (untested)

setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED | InputType.TYPE_NUMBER_FLAG_DECIMAL )
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜