Adir Rahamim
Adir Rahamim

Reputation: 453

EditText next Button keyboard

i have a layout which the user need to write his detailes in some editText which placed in a vertical linearLayout.

however, everyTime the user need to open the keyboard, write something on the editText and then to click on the back button in android and again click on the next editText and write his detailes and again over and over.

i want to implement that instead of opening and closing the keyboard, instead of the enter button on keyboard i will have a next Button that after the user entered his detailes on a spesific EditText , it will skip to the next EditText without closing and opening the keyboard every time.

i saw that there is some apps that has this feature, however i didnt find how can i implement it

thanks alot

here is the example of my layout:

<LinearLayout
        android:layout_width="283dp"
        android:layout_height="match_parent"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:orientation="vertical" >



        <TextView
            android:id="@+id/aaa"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="aaaa" >

            <requestFocus />
        </TextView>

        <EditText
            android:id="@+id/bbb"
            android:layout_width="match_parent"
            android:layout_height="36dp"
            android:background="@drawable/text_back"
            android:ems="10"
            android:inputType="bbb" />

        <TextView
            android:id="@+id/cccc"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="ccc" />

        <EditText
            android:id="@+id/emailTextGroup"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:background="@drawable/text_back"
            android:ems="10"
            android:inputType="textMultiLine" />

        <TextView
            android:id="@+id/dd"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="ddd" />

        <EditText
            android:id="@+id/fff"
            android:layout_width="match_parent"
            android:layout_height="38dp"
            android:background="@drawable/text_back"
            android:ems="10"
            android:inputType="fff" />

        <TextView
            android:id="@+id/yyy"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="yyy" />

        <EditText
            android:id="@+id/eeee"
            android:layout_width="match_parent"
            android:layout_height="32dp"
            android:background="@drawable/text_back"
            android:ems="10"
            android:inputType="textMultiLine" />

         <TextView
            android:id="@+id/yyyy"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="iii" />

        <EditText
            android:id="@+id/ooo"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:background="@drawable/text_back"
            android:ems="10"
            android:inputType="textMultiLine" />

        <TextView
            android:id="@+id/ppp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="ppp" />

        <EditText
            android:id="@+id/sss"
            android:layout_width="match_parent"
            android:layout_height="30dp"
            android:background="@drawable/text_back"
            android:ems="10"
            android:inputType="textMultiLine" />



    </LinearLayout>

Upvotes: 6

Views: 10002

Answers (3)

Emil Adz
Emil Adz

Reputation: 41099

You should add in the XML file an attribute to your EditTexts:

android:imeOptions="actionNext" .

The next button will bring the user into the next field that can receive input.

Upvotes: 7

JRowan
JRowan

Reputation: 7104

this is how my editText is and it has the next button and does is

<EditText
        android:id="@+id/typefish"
        android:layout_width="370dp"
        android:layout_height="wrap_content"

        android:singleLine="true" />

the one after it or the last one also has

android:imeOptions="actionDone"

Upvotes: 3

nano_nano
nano_nano

Reputation: 12523

There is a very good Documentation for this:

nextFocusDown

If I understand you correctly this tab order is exactly what you need.

Upvotes: 5

Related Questions