android - 创建编辑文本只接受或只能输入来自 a-z 的字母字符 only android

标签 android

我想制作一个编辑文本,其中只能输入字母字符意味着从 a 到 z 不允许其他数字或特殊字符,那么该怎么做?

我试过了

<EditText
     **android:inputType="text"**
     android:id="@+id/state" 
    android:singleLine="true"
    android:layout_marginTop="50dip" 
    android:layout_marginLeft="100dip" 
     android:layout_height="40dip"
      android:layout_width="200dip"
        />

但它接受所有值意味着数字和特殊字符也。那么如何限制它 表示用户只能输入 a-z 值。

最佳答案

输入您的 xml 相应的 EditText....

android:digits="abcdefghijklmnopqrstuvwxyz"

EditText 不接受数字或特殊字符,只接受字母..

关于android - 创建编辑文本只接受或只能输入来自 a-z 的字母字符 only android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7618658/

相关文章:

android - 为 DynamoDB Android SDK 实现 CreatedAt 和 UpdatedAt 时间戳

android - 如何在按下主页按钮后恢复以前的 Activity 并返回到应用程序

android - React Navigation + Redux 在按下返回时关闭应用程序

JavaScript 未在 onLoad 中加载(Android webView 浏览器问题)

android - 移动设备不支持的 css 属性列表

android - Admob wide_skyscraper AdSize 支持吗?

java - 我可以为 Android 制作 HTML5 游戏吗?

android - 使用 volley Json 获取空数组 [] 响应

android - Robotium - 我们如何找到 Activity 中元素的确切索引

java - 为什么 length() 用于在 Android 中的 json 解析中获取数组的大小?