When we use Sina Weibo to log on and register, we will find that when the mouse is placed on the first edittext component, the Enter key of the software will change to the next button. When it is placed on the last edittext, the enter key is changed to the "finish" button. This is very beneficial for users to use software for information input, with a good user experience.
In fact, the specific implementation steps are very simple.
If our layout contains multiple edittext controls and the Android: singleline attribute of each control is set to true, the text on the Enter key on the Soft Keyboard will change to "Next", and the next edittext will automatically get the focus (implementing the "Next" function ); when the last control gets the focus, the text on the Enter key is changed to "done", and the keyboard is automatically hidden after being pressed.
Set the imeoptions attribute of edittext to different values. Different texts or patterns can be displayed on the Enter key.
For example, set imeoptions of edittext to actionnext,
Set imeoptionslabel of edittext to "Next"
The enter key in the soft keyboard is changed to the "Next" button. After clicking it, the focus will jump to the next edittext control.
The imeoptions attributes of edittext are divided:
Actionnone: Enter key. Press the button and move the cursor to the next line.
Actiongo: Go,
Actionsearch: a magnifier
Actionsend: Send
Actionnext: Next
Actiondone: done to hide the keyboard, even if it is not the last text input box