How to add "Next" on Android keyboard

I have seen in some applications that a button appears on the keyboard called the next one, which focuses on the next text edit. I want to add this to my application, do you know how I can do this? Or is it just on the application keyboard? Many thanks. Sorry, I no longer have information about this.

+7
source share
4 answers

You just need to use the imeOptions tag in your layout. See imeOptions in the document.

<EditText android:id="@+id/someField" android:layout_width="match_parent" android:layout_height="wrap_content" android:imeOptions="actionNext"/> 
+7
source

In the edittext layout, add the android:imeOptions . Here you can add various action buttons, such as Go, Search, Send, Next, Done, etc. But to use this EditText must be singleLine Else, there will be an enter button. Therefore also use android:singleLine="true".

So here is your solution

 <EditText android:id=//put ur id android:layout_width=//according to need android:layout_height=//accordintoneed android:imeOptions="actionNext" android:singleLine="true"/> 

EDIT

to add, I have to add some more for future use or to help others.

You can handle display related actions from your code. for this you need to set setOnEditorActionListener in the Edittext, and when the action is clicked, you can get it on the public method boolean onEditorAction(TextView v, int actionId, KeyEvent event) . and if you don’t process the code yourself, the imeoptions action will perform the default action (usually moving to the next control).

Here is a sample code to handle the action

 EditText e = (EditText)findViewById(R.id.editText1); e.setOnEditorActionListener(new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_NEXT ) { // handle next button return true; } return false; } }); 
+12
source

You should add these two lines below to your EditText

 android:imeOptions="actionNext" android:singleLine="true" 
+2
source

I tried all of these answers posted here, but no one actually works. I gladly found a solution for this.

  <EditText android:id="@+id/etRegisterFirstName" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Firstname" android:imeOptions="actionNext" android:inputType="textCapWords" android:maxLines="1" /> <EditText android:id="@+id/etRegisterLastName" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Lastname" android:imeOptions="actionNext" android:inputType="textCapWords" android:maxLines="1" /> 

Please note that I am ADD android: inputType . This is it.

Cheers / Happy Coding

+1
source

All Articles