EditText Input type Issue(EditText 输入类型问题)
问题描述
我的屏幕上有一个名称EditText
.我只想接受 a-z,A-Z 中的字母表示并且不应接受数字、特殊字符.
There is a name EditText
in my screen. I want to accept only alphabets means from a-z,A-Z
and should not accept numbers, special chars.
我正在使用 inputtype="textPersonName"
但它不起作用,它接受意味着显示所有数字、字符等.
I'am using inputtype="textPersonName"
for that but its notworking, it accepts means showing all numbers, chars etc..
对于电话字段 inputtype="phone"
正在工作,它接受意味着仅在字段中显示数字.
For phone field inputtype="phone"
is working it accepting means showing numbers in field` only.
为什么会这样?
推荐答案
最好的办法是使用 InputFilter 来限制 EditText 控件中允许的字符.您应该能够轻松地适应 如何在 Android 中使用 InputFilter 来限制 EditText 中的字符? 做你需要的.
Your best bet is to use an InputFilter to restrict the characters that are permitted in your EditText control. You should be able to easily adapt the answer from How do I use InputFilter to limit characters in an EditText in Android? to do what you require.
这篇关于EditText 输入类型问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:EditText 输入类型问题


- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01