0

I'm making an APP and want to change the keyboard "Line Break" key into a "Done" key, But I cant use the android:signleLine="true" (seen here: Done key not showing up on keyboard) because the EditText isn't the last EditText in my code.

What could I use/do instead?

Thanks.

Edit
Here is my code:

<EditText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/editText"
            android:width="40dp"
            android:maxLength="1"
            android:lines="1"
            android:textStyle="bold"
            android:inputType="textCapCharacters|textFilter"
            android:digits="ABCDEFGHIJKLMNOPQRSTUVXYZ"
            android:textAlignment="center"
            android:layout_centerVertical="true"
            android:layout_centerHorizontal="true"/>
Community
  • 1
  • 1
urukh
  • 360
  • 1
  • 3
  • 17
  • Are you using Startdard Key board of android of is there any other app for keyboard try in other phone with imeOptions="actionDone" – Milind Vyas Jun 25 '16 at 04:44

2 Answers2

3

You can use to set the keyboard action button imeOptions

<EditText
    android:id="@+id/search"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:hint="@string/search_hint"
    android:inputType="text"
    android:imeOptions="actionDone" />

Read more about imeOptions here

You will also have to remove the line

android:digits="ABC..."

as imeOptions do not work well with this.

Anuj
  • 1,912
  • 1
  • 12
  • 19
0

You can Try this.

By XML

android:imeOptions="actionDone"

By Java

editText.setImeOptions(EditorInfo.IME_ACTION_DONE);

this may helps you.

Sathish Kumar J
  • 4,280
  • 1
  • 20
  • 48