1

Goal is to use multiline EditText with android:inputType="textMultiLine" and with "next view button" such as android:inputType="text" (see picture 2).

<EditText
    android:id="@+id/addAffirmationContent"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:inputType="textMultiLine"
    android:maxLength="255"
    android:imeOptions="flagNoExtractUi" />

I tried many combinations with: android:inputType, singleLine, nextFocusDown, nextFocusUp, nextFocusLeft, nextFocusRight, nextFocusForward, imeOptions, lines, but android:inputType="textMultiLine" always forces new line button.

Tested on Nexus 5 Android 7.

Picture 1.: new line button:
new line button

Picture 2.: next view button:
next view button

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
t0m
  • 3,004
  • 31
  • 53

2 Answers2

5

I think what you are looking for is the same as in this answer:

In code:

editText.setImeOptions(EditorInfo.IME_ACTION_NEXT);
editText.setRawInputType(InputType.TYPE_CLASS_TEXT);

and in xml:

android:inputType="textMultiLine"
MikeL
  • 2,756
  • 2
  • 23
  • 41
  • That's the correct answer! The solution did the trick. The only thing I wouder is why this combination gives us that behaviour? In fact we set inputType in code as a text reassigning inputType of xml which is textMultilane and in the end it's still acts as multiline but with action option. Could someone tell me what is exactly happening? – splekhanov Jul 30 '23 at 10:31
0

These three lines in combination should replace your "enter" with "next"

<EditText 
    android:inputType="text"
    android:maxLines="1"
    android:imeOptions="actionNext" />

Android have a lot of"android:imeOptions" to specify the keyboard action button

android:imeOptions="actionGo"
android:imeOptions="actionDone"
android:imeOptions="actionNext"
android:imeOptions="actionPrevious"
android:imeOptions="actionSend"

and there are even more

Rainmaker
  • 10,294
  • 9
  • 54
  • 89
  • I do not want block Enter. I want to see and use next view button (see picture 2) instead of Enter button. – t0m Feb 21 '18 at 18:45
  • @t0m i'm sorry didn't get it right, now I see, I managed to do it in one of my projects with this combination (see edited code), I understand that you tried some combinations but maybe you didn't try this – Rainmaker Feb 21 '18 at 19:09
  • This is not multiline `EditText`. – t0m Feb 22 '18 at 08:48