Emaborsa
Emaborsa

Reputation: 2860

android:nextFocusDown doesn't work

I designed a layout with four EditText and i want to facilitate the navigation of them. I understand the use of android:nextFocusDown but i'm not able to get it to work. I also setted the ´ImeOptions´ to actionNext, but on the softpad I neither see the right icon.

My XML snippet:

            <EditText
                android:id="@+id/reservation_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:background="@drawable/edit_text_reservation"
                android:ems="10"
                android:hint="@string/yourName"
                android:imeOptions="actionNext"
                android:nextFocusDown="@+id/reservation_surname" >

            </EditText>

            <EditText
                android:id="@+id/reservation_surname"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:background="@drawable/edit_text_reservation"
                android:ems="10"
                android:hint="@string/yourSurname"
                android:imeOptions="actionNext"
                android:nextFocusDown="@+id/reservation_email"
                android:nextFocusUp="@+id/reservation_surname" />

            <EditText
                android:id="@+id/reservation_email"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:background="@drawable/edit_text_reservation"
                android:ems="10"
                android:hint="@string/yourEmail"
                android:imeOptions="actionNext"
                android:inputType="textEmailAddress"
                android:nextFocusDown="@+id/reservation_notes"
                android:nextFocusUp="@+id/reservation_email" />

           <EditText
                android:id="@+id/reservation_notes"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/edit_text_reservation"
                android:ems="10"
                android:imeOptions="actionDone"
                android:inputType="textMultiLine"
                android:nextFocusUp="@id/reservation_notes" />

Upvotes: 2

Views: 4248

Answers (1)

Murray
Murray

Reputation: 189

I had a similar issue, where nextFocus* simply did not work. In your case.. going from

<EditText android:id="@+id/reservation_name"...
          android:nextFocusDown="@+id/reservation_notes"

to

change surname's id to NOT have a "+" i.e. <EditText android:id="@id/reservation_surname" this way you are no creating a new reference to that tag. This will now work.

Upvotes: 1

Related Questions