In meiner App verwende ich einen Custum Dialog (android.app.Dialog) mit drei Edit-Texten drin. Ich kann den nächsten Fokus vom ersten bis zum zweiten EditText einstellen, wenn ich den nächsten Button auf dem SoftKeyboard drücke, aber es funktioniert nicht, um den Fokus auf den dritten EditText zu legen. Ich habe bereits versucht, nextFocusForward oder nextFocusDown und so weiter zu setzen, aber es funktioniert immer noch nicht. HierFokus auf letzten Edittext im benutzerdefinierten Dialog funktioniert nicht
ist das XML-Layout aus meinem benutzerdefinierten Dialog:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/addcard_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/dialog_addcard_info" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="@+id/addcard_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:hint="@string/name"
android:inputType="text"
android:lines="1"
android:maxLines="1"
android:scrollHorizontally="true" />
<EditText
android:id="@+id/addcard_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:hint="@string/number"
android:inputType="number"
android:maxLength="16"
android:scrollHorizontally="true"/>
<EditText
android:id="@+id/addcard_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="8dp"
android:hint="@string/pin"
android:inputType="numberPassword"
android:maxLength="4"
android:textSize="14sp"
android:scrollHorizontally="true"/>
</LinearLayout>
<TextView
android:id="@+id/addcard_errormessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:text="@string/error"
android:textColor="#ff0000"
android:textStyle="bold"
android:visibility="gone" />
<Button
android:id="@+id/addcard_verify"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="@string/verify" />
</LinearLayout>
Hat jemand eine Idee, warum ich nicht in der Lage bin, den Fokus auf dem dritten EditText zu setzen? Vielen Dank im Voraus.
ein 'android Hinzufügen: imeOptions = "actionNext"' zu den ersten beiden EditText tun sollten. Ich denke, was Sie suchen, ist [das] (https://developer.android.com/reference/android/widget/TextView.html#attr_android:imeOptions) –