1

I have taken below layout as a row layout for my recyclerview :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
    <TextView
            android:id="@+id/tv_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="@dimen/dimen_15"
            android:textColor="@color/colorBlack"
            android:textSize="@dimen/font_dimen_16"
            app:font_type="regular"
            tools:text="day" />
    <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:orientation="horizontal">
        <EditText
                android:id="@+id/edt_rs"
                style="@style/edt_rounded_style"
                android:hint="@string/str_rs"
                android:imeOptions="actionDone" />
        <EditText
                android:id="@+id/edt_discounted_price"
                style="@style/edt_rounded_style"
                android:hint="@string/str_discounted_price"
                android:imeOptions="actionDone" />
    </LinearLayout>
    <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/dimen_0p1"
            android:layout_marginTop="@dimen/dimen_5"
            android:layout_marginBottom="@dimen/dimen_5"
            android:background="@color/colorGrey" />
</LinearLayout>

Now, you can see as above, There are two EditText in a singal row of Recyclerview.

I have to move next from one EditText to another : Horizontally and then Vertically.

For example if I have written something in first edittext then on clicking NEXT in softkeyboard, second EditText in same row should get focus.

Same way, When I complete entering value for the second EditText in same row then clicking on NEXT, the next edittext in next row should get focus.

It's matter of navigation between EdiTexts inside RecyclerView.

How can I achieve this ?

Thanks.

Jaimin Modi
  • 1,530
  • 4
  • 20
  • 72

1 Answers1

2

Use FocusDown tag in edittext for navigation

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
<TextView
        android:id="@+id/tv_per_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="@dimen/dimen_15"
        android:textColor="@color/colorBlack"
        android:textSize="@dimen/font_dimen_16"
        app:font_type="regular"
        tools:text="Per day" />
<LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:orientation="horizontal">
    <EditText
            android:id="@+id/edt_rs"
            android:nextFocusDown="@id/edt_discounted_price"
            style="@style/edt_rounded_gym_fees_style"
            android:hint="@string/str_rs"
            android:imeOptions="actionDone" />
    <EditText
            android:id="@+id/edt_discounted_price"
            style="@style/edt_rounded_gym_fees_style"
            android:hint="@string/str_discounted_price"
            android:imeOptions="actionDone" />
</LinearLayout>
<View
        android:layout_width="match_parent"
        android:layout_height="@dimen/dimen_0p1"
        android:layout_marginTop="@dimen/dimen_5"
        android:layout_marginBottom="@dimen/dimen_5"
        android:background="@color/colorGrey" />

Vish
  • 404
  • 3
  • 17
  • 1
    This will work for singal row. What if I want to move from discountedprice of first row to edt_rs of next row ? – Jaimin Modi Jan 01 '20 at 06:47