EditText上输入类型问题 [英] EditText Input type Issue

查看:104
本文介绍了EditText上输入类型问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个在我的屏幕名称的EditText 。我想只接受字母指从AZ,AZ 不应该接受数字,特殊字符。

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为,但其notworking,它接受方式显示所有的数字,字符等。

I'am using inputtype="textPersonName" for that but its notworking, it accepts means showing all numbers, chars etc..

有关手机领域 inputtype =手机正在接受它的手段表示field`数字而已。

For phone field inputtype="phone" is working it accepting means showing numbers in field` only.

为什么要这样呢?

推荐答案

您最好的选择是使用输入过滤的限制,允许在你的EditText控件的字符。你应该能够很容易适应的答案<一href="http://stackoverflow.com/questions/3349121/how-do-i-use-inputfilter-to-limit-characters-in-an-edittext-in-android/4401227#4401227">How我用输入过滤器在Android中一个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上输入类型问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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