ActionNext & textMultiline not working
I want to Multiline
EditText
be allowed imeOptions="actionNext"
.
This works, but only allows single line input
<EditText>
...
android:inputType="textCapSentences|textAutoCorrect"
android:imeOptions="actionNext"
...
</EditText>
This changes imeOption
to the enter key.
<EditText>
...
android:inputType="textCapSentences|textAutoCorrect|textMultiline"
android:imeOptions="actionNext" <!-- Why is this code skipped? -->
...
</EditText>
The Google Keep and Gmail apps do it somehow, so don't tell me it's impossible.
+3
source to share
1 answer
The enter key can only do one thing: type a new line into the editor, or move the cursor to the next field. One way to do this is to translate the enter key into the next field, but still allow the text to auto-update in the editor.
In XML:
<EditText
android:singleLine="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="@string/default_label_a"
android:selectAllOnFocus="true"
android:maxLines="5"
android:imeOptions="actionNext"
/>
In code:
edittext.setHorizontallyScrolling(false);
edittext.setMaxLines(Integer.MAX_VALUE);
+3
source to share