0

I am making an Android app and want the done key to show up on the keyboard when the user is typing into the keyboard. This is the XML code for the EditText:

    <EditText
    android:id="@+id/answer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10"
    android:gravity="center_horizontal"
    android:textColor="#ffffff"
    android:layout_marginBottom="113dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:imeOptions="actionDone"
    />

I thought that adding the android:imeOptions="actionsDone would have the done button appear, but instead the enter button is there and when it is pressed, a new line is created in the EditText. What is the issue?

RainbowJeremy
  • 63
  • 4
  • 13

1 Answers1

2

You will not get done by adding imeOptions. Add the below attribute to your EditText:

android:singleLine="true"

This will make your EditText a single line and you will see the Done button if that is the only EditText or last EditText. If there are multiple EditText items, then you will see Next button.

Abandoned Cart
  • 4,512
  • 1
  • 34
  • 41
Pankaj
  • 7,908
  • 6
  • 42
  • 65