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
Finally i have got sure solution for this issue Just add these 3 lines in your edit text and it will be working fine
android:maxLines="1"
android:inputType="text"
android:imeOptions="actionDone"
Here you can add maxLines according to your requirement. Do not use singleLine as it is deprecated now. Good luck!
Just add android:maxLines="1" & android:inputType="text"
to your EditText. It will work!! :)
android:singleLine
has been deprecated, it is better to combine android:maxLines="1"
with android:inputType="text"
. This would be the code:
<EditText
android:id="@+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:inputType="text"
/>
Key here is to set input type and imeOptions attributes
<EditText
android:inputType="number"
android:maxLines="1"
android:imeOptions="actionSearch" />
Only this worked for me.
Change it:
android:maxLines="1"
android:inputType="text"
android:imeOptions="actionNext"
on that:
android:singleLine="true"
android:inputType="text"
android:imeOptions="actionNext"
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/auth_register_re_password"
android:hint="Enter Password Again"
android:imeActionLabel="login"
android:gravity="center"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"/>