EditText 下一个焦点不起作用

EditText Next Focus is not woking

我在同一屏幕上有几个 EditTextNext soft key button 不存在。输入软键在那里,但是,每当我按下该按钮时,它都不会转到下一个 EditText。在到达最后一个 EditText 之后,我想隐藏软键盘。我应该怎么做才能实现这一目标。我在 Whosebug 中找到了很多问题和解决方案。对我没用。

编辑文本代码:

<EditText
        android:id="@+id/vehicle_number"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:imeOptions="flagNoExtractUi|actionNext|actionGo|actionDone"
        android:paddingLeft="5dp"
        android:textSize="25dp"
        android:maxLength="12"
        android:hint="GA-00-A0000"
        android:digits="1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-"
        android:nextFocusForward="@+id/vehicle_color"
        android:inputType="textCapCharacters"
        android:background="@drawable/edittext_rect_yellow_border" />

也尝试了 java 代码,

vehicle_number.setNextFocusDownId(R.id.vehicle_color);

我修好了。解决方案如下。现在 'Next' 软键显示。

已移除

android:inputType="textCapCharacters"

已添加

android:maxLines="1"
android:singleLine="true"

对于大写字符

vehicle_number.setInputType(InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS);

解决方案

<EditText
        android:id="@+id/vehicle_number"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:imeOptions="flagNoExtractUi"
        android:paddingLeft="5dp"
        android:textSize="25dp"
        android:maxLength="12"
        android:hint="GA-00-A0000"
        android:maxLines="1"
        android:singleLine="true"
        android:digits="1234567890qwertyuioplkjhgfdsazxcvbnm-"
        android:background="@drawable/edittext_rect_yellow_border" />