Android soft keyboard custom "Done" button text?

Skizit picture Skizit · Jun 7, 2011 · Viewed 17.4k times · Source

I'm aware I can set my "done" button to different things using

EditText.setImeOptions();

but how would I set it to custom text? Is it possible for me to specifiy what text I want it to be?

Answer

Michael Alan Huff picture Michael Alan Huff · Mar 29, 2013

Actually you can set custom text to that little blue button. In the xml file just use

android:imeActionLabel="whatever"

on your EditText.

Or in the java file use

etEditText.setImeActionLabel("whatever", EditorInfo.IME_ACTION_DONE);

I arbitrarily chose IME_ACTION_DONE as an example of what should go in the second parameter for this function. A full list of these actions can be found here.

It should be noted that this will not cause text to appear on all keyboards on all devices. Some keyboards do not support text on that button (e.g. swiftkey). And some devices don't support it either. A good rule is, if you see text already on the button, this will change it to whatever you'd want.