Skip to content

Instantly share code, notes, and snippets.

@ajaypro
Created December 14, 2019 12:47
Show Gist options
  • Save ajaypro/4116c8b9d8ec69237a64e26307bce549 to your computer and use it in GitHub Desktop.
Save ajaypro/4116c8b9d8ec69237a64e26307bce549 to your computer and use it in GitHub Desktop.
android:imeOptions="actionDone" does not work
consider you want to have an EditText for taking only alpha numeric values as input.
<android.support.v7.widget.AppCompatEditText
android:id="@+id/newDeliverable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:digits="1234567890 abcdefghijklmnopqrstuvwxyz"
android:hint="@string/hint_add_new_deliverable"
android:imeOptions="actionDone"
android:inputType="text" />
`android:digits` causes the issue
Solution:
you have to add android:singleLine attribute.
If we have android:digits attribute in EditText, then android:imeOptions will work when we add android:singleLine attribute.
<android.support.v7.widget.AppCompatEditText
android:id="@+id/newDeliverable"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:digits="1234567890 abcdefghijklmnopqrstuvwxyz"
android:hint="@string/hint_add_new_deliverable"
android:imeOptions="actionDone"
android:inputType="text"
android:singleLine="true" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment