Reputation: 1395
I'm making an android application and I have an EditText element where, once you press enter in that field, text elsewhere on the same page is updated, though you cannot immediately see it because the keyboard is in the way. In short, is there a way to have the keyboard go away (i.e. have the text editor de-select itself when enter is pressed)?
Upvotes: 3
Views: 1530
Reputation: 6892
You just have to set your EditText
as singleLine and enable the IMEAction
Done, like this:
<EditText
android:id="@+id/myEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:singleLine="true"
android:imeActionLabel="Done"
android:imeOptions="actionDone"
android:textColor="@android:color/black"
android:textSize="16sp" />
Upvotes: 2