android:imeOptions =“ actionNext”无法正常工作

时间:2019-07-19 11:24:35

标签: android android-layout textinput imeoptions

我正在创建注册页面,但是在每个TextInputEditText上添加了下一步按钮,它运行正常,没有任何问题,

但是每当我在布局中添加android:digits="0123456789qwertzuiopasdfghjklyxcvbnm_ "时,它就不起作用。

解决方案的可能原因是什么?

下面是我的代码段。

  <com.google.android.material.textfield.TextInputLayout
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:textColorHint="#c0c0c0"
                    app:errorEnabled="true"
                    app:theme="@style/MyTextInputLayoutStyle">
                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/activity_register_edit_text_state"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:ems="10"
                        android:hint="@string/state_region"
                        android:imeOptions="actionNext"
                       android:digits="0123456789qwertzuiopasdfghjklyxcvbnm_ "            
           android:inputType="textPersonName"
                         android:padding="@dimen/edittext_padding"
                        android:textColor="@color/text_color_light"
                        android:theme="@style/MyTextInputLayoutStyle"
                        app:errorTextAppearance="@style/TextErrorAppearance"
                        app:xfont="@string/roboto_regular" />
                </com.google.android.material.textfield.TextInputLayout>

谢谢。

1 个答案:

答案 0 :(得分:1)

当您在EditText或TextInputEditText中设置android:digits时,它仅允许您在其中定义的数字或字符。在android软输入(键盘)中,下一个按钮具有android中未定义的唯一代码:数字。

请参阅此link以获得更好的理解

相关问题