简体   繁体   中英

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>

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

android:imeOptions="actionNext" .

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

There is a very good Documentation for this:

nextFocusDown

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

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM