Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android keyboard next button issue on EditText

I am facing an issue, I have username & password fields on activity, now when I click on username keyboard appears but no next button on it and I cannot move to next Edittext control through keyboard in this case, keyboard displays enter button in it as attached in screenshot which increases its height,

Can anyone guide me what is the solution to this problem (to display next button on edittext)?

enter image description here

My Code

txtUserid = (EditText)findViewById(R.id.txtUserID);         txtUserPasword = (EditText)findViewById(R.id.txtPassword);          txtUserid.setNextFocusDownId(R.id.txtPassword);         txtUserPasword.setNextFocusDownId(R.id.btnLogin); 
like image 693
UMAR-MOBITSOLUTIONS Avatar asked Jan 25 '12 13:01

UMAR-MOBITSOLUTIONS


People also ask

How to add next button in keyboard android?

In the layout of edittext add android:imeOptions attribute. Here you can add different action buttons like Go, Search , Send , Next, Done etc. But to use this the EditText has to be a singleLine Else there will be an enter button there. So also use the android:singleLine="true".

How do I change the Done button on my android keyboard?

First you need to set the android:imeOptions attribute equal to actionDone for your target EditText as seen below. That will change your 'RETURN' button in your EditText's soft keyboard to a 'DONE' button.

How do I change the focus to next text in android?

Use android:nextFocusDown="next_EditText_id" Show activity on this post. Show activity on this post. The solution coding is OK, Below codes indicate that auto move to next Edit Text and auto move to previous Edit Text.


2 Answers

Add android:singleLine="true" android:nextFocusDown="@+id/textView2" on your xml. Will show Next key and also focus to the next field.

like image 174
nijas Avatar answered Sep 30 '22 19:09

nijas


In your layout, just set the XML attributes android:imeOptions="actionNext" for your first three text boxes and android:imeOptions="actionDone" for the last one.

More Examples

like image 36
deepak Sharma Avatar answered Sep 30 '22 18:09

deepak Sharma