android - 如何限制 EditText 中的输入?

标签 android android-widget android-edittext

我有一个EditText。 我只想输入字符:a->z,A->Z,0->9 and @.#,-,_ 如何在 EditText 中限制键盘输入的键值?

最佳答案

试试这个

<EditText 
  android:layout_height="wrap_content" 
  android:layout_width="match_parent" 
  android:inputType="text"
  android:digits="0123456789......yourcharcters"/>

关于android - 如何限制 EditText 中的输入?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13876158/

相关文章:

android - "The specified child already has a parent. You must call removeView() on the child' s parent first”第二次创建AlertDialog

android - 未列出新联系人

android - 将动画添加到 android-wheel

android - pendingintent 有时不工作

Android EditText 文本的偏移量?

java - 在 00 :00 format? 中创建一个以秒为单位的递增计时器

android - 具有不同样式的菜单项

java - 如何在 android 小部件 EditText 中添加水印?

android - 如何重组布局以使其更好?

android edittext inputType :textpassword not working with intputType:actionDone on some devices