Reputation: 1767
I Need to change the focus to the edite text in the right side. I have alredy given the android:nextFocusRight
But. it is not moving to the ridhtside. insted it move the focus to the down side.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<EditText
android:id="@+id/edt1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:nextFocusRight="@id/edt2"
android:inputType="text"
android:singleLine="true" />
<EditText
android:id="@+id/edt2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true" />
</LinearLayout>
Upvotes: 1
Views: 381
Reputation: 33
You Just have to use property "nextFocusDown" instead of "nextFocusRight" it will solve your Problem
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<EditText
android:id="@+id/edt1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="text"
android:nextFocusDown="@id/edt2"
android:singleLine="true" />
<EditText
android:id="@+id/edt2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true" />
</LinearLayout>
Upvotes: 0
Reputation: 69689
Try this use android:imeOptions="actionNext"
in your edt1
EditText
it will work
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal">
<EditText
android:id="@+id/edt1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:imeOptions="actionNext"
android:nextFocusRight="@+id/edt2"
android:inputType="text"
android:singleLine="true" />
<EditText
android:id="@+id/edt2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true" />
</LinearLayout>
Upvotes: 2