如何限制 TextView 在 Android 中仅允许使用字母数字字符 [英] How to restrict TextView to allow only alpha-numeric characters in Android
本文介绍了如何限制 TextView 在 Android 中仅允许使用字母数字字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的应用中有一个 TextView,我希望用户只能在其中输入字母数字字符.如何做到这一点?谢谢!
I have a TextView in my app that i want a user to be able to only enter alpha-numeric characters in. How can this be done? Thanks!
推荐答案
在 XML 中,这样写:
In the XML, put this:
android:digits="abcdefghijklmnopqrstuvwxyz1234567890 "
这篇关于如何限制 TextView 在 Android 中仅允许使用字母数字字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文