The problem is you are clicking on Enter key instead of the actionNext you need in order to move cursor to next EditText
Specify the Input Method Action
Most soft input methods provide a user action button in the bottom
corner that's appropriate for the current text field. By default, the
system uses this button for either a Next or Done action unless your
text field allows multi-line text (such as with
android:inputType="textMultiLine"), in which case the action button is
a carriage return. However, you can specify additional actions that
might be more appropriate for your text field, such as Send or Go.
It causes carriage return for your action button. So it means that doesn't fire android:nextFocusDown
First of all, lets see what is difference between singleLine which is deprecated and maxLines
singleLine
When you set android:singleLine="true"
one line text is in EditText visible but Enter key isn't visible in keypad
maxLines
when you set android:maxLines
attribute with the particular value only same amount of line text is visible in EditText and enter key in keypad also visible for Entering.
So When you click action button it is firing Enter Action according to your code. Also you must change your inputType attribute with android:inputType="textMultiLine"
if you use android:maxLines
attribute
maxLines
added in API level 1 int maxLines Makes the TextView be at most this
many lines tall. When used on an editable text, the inputType
attribute's value must be combined with the textMultiLine flag for the
maxLines attribute to apply.
May be an integer value, such as "100".
When I customized your code with the correct attributes still it was firing Enter key instead of IME_ACTION_NEXT which you want. I think it didn't solve the problem due to
textMultiLine Can be combined with text and its variations to allow
multiple lines of text in the field. If this flag is not set, the text
field will be constrained to a single line. Corresponds to
TYPE_TEXT_FLAG_MULTI_LINE.
TYPE_TEXT_FLAG_MULTI_LINE
added in API level 3 int TYPE_TEXT_FLAG_MULTI_LINE Flag for
TYPE_CLASS_TEXT: multiple lines of text can be entered into the field.
If this flag is not set, the text field will be constrained to a
single line. The IME may also choose not to display an enter key when
this flag is not set, as there should be no need to create new lines.
Constant Value: 131072 (0x00020000)
SOLUTION:
Subclass EditText and adjust the IME options. After that you don't need android:maxLines
or android:singleLine
attributes.
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
InputConnection connection = super.onCreateInputConnection(outAttrs);
int imeActions = outAttrs.imeOptions&EditorInfo.IME_MASK_ACTION;
if ((imeActions&EditorInfo.IME_ACTION_NEXT) != 0) {
// clear the existing action
outAttrs.imeOptions ^= imeActions;
// set the DONE action
outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT;
}
if ((outAttrs.imeOptions&EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) {
outAttrs.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION;
}
return connection;
}
You could also check another post here. I reconfigured the accepted answer of this post on your purpose