如何阻止机器人EDITTEXT特殊字符?没有ANDROID:DIGITS [英] How to block special characters in androids editText? no ANDROID:DIGITS

查看:227
本文介绍了如何阻止机器人EDITTEXT特殊字符?没有ANDROID:DIGITS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何阻止机器人EDITTEXT特殊字符?
   不使用的 Android版本:数字

How to block special characters in androids editText? by not using android:digits!!

有没有其他方式,甚至编程?

is there any other way around, even programmatically?

推荐答案

EditText上有一个onTextChanged监听器,你可以按照用户的输入字符,如果字符是非法的,你只是删除它。不是最优雅的方式,但希望这使得它。祝你好运!

EditText has an onTextChanged listener, you can follow the characters the user is inputting and if the character is illegal you just delete it. Not the most elegant way, but hope it makes it. Good luck!

这篇关于如何阻止机器人EDITTEXT特殊字符?没有ANDROID:DIGITS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆