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)?
My Code
txtUserid = (EditText)findViewById(R.id.txtUserID); txtUserPasword = (EditText)findViewById(R.id.txtPassword); txtUserid.setNextFocusDownId(R.id.txtPassword); txtUserPasword.setNextFocusDownId(R.id.btnLogin);
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".
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.
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.
Add android:singleLine="true" android:nextFocusDown="@+id/textView2"
on your xml. Will show Next key and also focus to the next field.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With