问题
I have a problem with the keyboard. I have a ListView with edit texts, and when the keyboard opens for the first time the Done button is displayed instead of Next. The problem is that I need to use adjustResize in the AndroidManifest.xml and the list is moved up when the keyboard is displayed, so I think this is why the keyboard is not working properly.
How can I solve this issue?
回答1:
Add android:imeOptions="actionDone" to the field where you need a done button on your keyboard.
Add android:imeOptions="actionNext" to the field where you need a next button.
Also, ime has many option buttons like go, send, search, etc.
回答2:
In your layout, just set the XML attributes android:imeOptions="actionNext" for your EditText boxes in which you want next button to show and android:imeOptions="actionDone" for the last one.
To gain focus for your editText just do like this :
your_editText.setOnEditorActionListener(new OnEditorActionListener()
{
public boolean onEditorAction(TextView v, int actionId, KeyEvent event)
{
if (actionId == EditorInfo.IME_ACTION_NEXT)
{
your_editText.requestfocus(true);
return true;
}
return false;
}
});
来源:https://stackoverflow.com/questions/19110352/android-done-button-instead-of-next