I have a fairly complex (not really) xml layout file. One of the views is a LinearLayout (v1
) with two children: an EditText(v2
) and another Linear
android:inputType="text"
You have to specify an inputType in order for imeOptions to function.
below code is force
android:inputType="text"
single line deprecated so you add below code I think inputType must.
<EditText
android:inputType="text"
android:maxLines="1"
android:imeOptions="actionNext" />
These three lines are enough.
android:singleLine="true"
android:inputType="text"
android:imeOptions="actionNext"
The answers given here were all very helpful, but I was still struggling to get my keyboard's "Next" to show.
Turns out that when you use Android's android:digits
attribute in your XML, it prevents the android:imeOptions="actionNext"
from working as expected.
The answer is actually to use the deprecated android:singleLine="True"
. This seems to force the IME Option to be respected.
Old, Non-Working Code
<android.support.design.widget.TextInputEditText
android:id="@+id/first_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ- "
android:ellipsize="end"
android:hint="@string/first_name"
android:imeOptions="actionNext"
android:inputType="textCapWords"
android:maxLength="35"
android:maxLines="1" />
Working Code
<android.support.design.widget.TextInputEditText
android:id="@+id/first_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ- "
android:ellipsize="end"
android:hint="@string/first_name"
android:imeOptions="actionNext"
android:inputType="textCapWords"
android:maxLength="35"
android:maxLines="1"
android:singleLine="true" />
I'm not a fan of using a deprecated attribute, but for now it seems to get the desired result.
singleLine
is deprecated. Adding an input type (eg: android:inputType="text"
) also worked for me.
Use android:maxLines="1"
as singleLine
is deprecated