如何限制Android的编辑文本字段只针对某些选定的字符 [英] How to limit Android edit text field only for some selected characters
本文介绍了如何限制Android的编辑文本字段只针对某些选定的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有什么办法来限制允许输入时只有某些选定的字符集的用户(例如:A或B或C或D)的安卓layout.xml
Is there any way to limit users allowed to type only some selected character set (Eg: A or B or C or D) in Android layout.xml
推荐答案
使用的<一个href="http://developer.android.com/reference/android/widget/TextView.html#attr_android%3adigits"><$c$c>digits$c$c>属性,只能传递给位的字符
将在允许的EditText。
Use the digits
attribute, only the characters passed to digits
will be allowed in the EditText.
android:digits="abc123"
是的,数字是一个误导性的名称,它接受字母和符号了。
And yes, "digits" is a misleading name, it accepts letters and symbols too.
这篇关于如何限制Android的编辑文本字段只针对某些选定的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文