RainbowJeremy
RainbowJeremy

Reputation: 73

Done key not showing up on keyboard

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?

Upvotes: 1

Views: 910

Answers (1)

Pankaj
Pankaj

Reputation: 8058

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.

Upvotes: 2

Related Questions