Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/187.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Edittext使用inputtype作为手机不能使用字母数字_Android - Fatal编程技术网

Android Edittext使用inputtype作为手机不能使用字母数字

Android Edittext使用inputtype作为手机不能使用字母数字,android,Android,在我的Android应用程序中,我有一个字段,其中95%的时间都是数字。 因此,我将edittext的输入类型设置为“number” 但我有一些情况,用户必须在字段Ex:AF1233636中输入char 在我的例子中,使用标准字母数字键盘是一个糟糕的选择,因为用户必须戴手套 所以我找到了输入类型“phone”,其中有数字和字符,但只有数字起作用 我无法在字段中仅获取数字 <EditText android:id="@+id/fld_tag" androi

在我的Android应用程序中,我有一个字段,其中95%的时间都是数字。 因此,我将edittext的输入类型设置为“number” 但我有一些情况,用户必须在字段Ex:AF1233636中输入char

在我的例子中,使用标准字母数字键盘是一个糟糕的选择,因为用户必须戴手套

所以我找到了输入类型“phone”,其中有数字和字符,但只有数字起作用

我无法在字段中仅获取数字

  <EditText
        android:id="@+id/fld_tag"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:clickable="true"
        android:cursorVisible="false"
        android:inputType="phone"
        android:digits="0123456789abcdefghijklmnopqrstuvwxyz"
        android:focusable="true"
        android:maxLength="10"
        android:textStyle="bold" />


因此,当用户继续按某个号码时,我希望字符显示为在旧手机上编写文本时的字符


有什么想法吗?

查看本教程,了解如何创建自定义IME。。。创建与此类似的东西,除了t9功能。数字下面的字母只是为了在手机风格的应用程序中输入时显示出来