android:maxLength Since: API Level Set an input filter to constrain the text length to the specified number. Must be an integer value, such as "100". This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type. This corresponds to the global attribute resource symbol maxLength.
你懂的
Since: API Level Set an input filter to constrain the text length to the specified number. Must be an integer value, such as "100". This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type. This corresponds to the global attribute resource symbol maxLength.
嗯嗯,俺就想到这样子的方法
不需要通过在java代码内面if判断什么的
android:inputType="number"属性里边这么写,OK了