How to Customize Displayed Text on Return Key | Android Input Method

Android IME Options
Default imeOptions Dispaly

The “Action” text displayed on the return key or enter key in Android soft keyboard can be customized with different action values using IME or android:imeOptions in your XML layout file. Some of the action values that. I am sure you have come across especially when entering text in EditText widget are “Next”, “Go”, mirror image for “Search” and few more.

As developer, sometimes we do not pay attention to cosmetic details like this. Certainly, users who use your app appreciate if they can quickly figure out how to use it once they download from the market. If the input method is not specified, the default displayed value will be set according to the phone or device.

Here’s an XML layout with and without custom input method options declared for the return key.

 

 

After creating an XML layout with customized action display on return key, we can focus on each EditText widget and see the results.

Emulator images:

android actionDone imeOptions android actionSend imeOptions

Going through the layout, android:imeOptions is not declared on name1 EditText widget. ¬†When in focus, the displayed text on return key is by default determined by the emulator, see the first image. On the other hand when focused, the customized name2 and zipcode EditText widget respectively display “Done” and “Send” on enter key.

To finish it up on Android Input Method or IME, I have listed android:imeOptions below that can be used to customize return key with their respective action events.

 

Text to Display imeOptions Action Event
Send actionSend IME_ACTION_SEND
Next actionNext IME_ACTION_NEXT
Done actionDone IME_ACTION_DONE
Go actionGo IME_ACTION_GO
Search actionSearch IME_ACTION_SEARCH
Default actionUnspecified IME_ACTION_NULL

Hope this is what you have been looking for and good luck on your next app.

This entry was posted in Android Development Tutorials, Android Layouts and tagged , , , , , . Bookmark the permalink.

Comments are closed.