RainbowJeremy RainbowJeremy - 5 months ago 5
Android Question

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?

Answer

You will not get done by adding imeOptions. Add below attribute to your edittext

android:signleLine="true"

which will make your edittext to single line and you can see done button if that is the only one edittext or last edittext. Otherwise if there are couple of edittext then you will see next button.

Comments