Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show keyboard programatically on Android with an OK/DONE button

I am trying to show the soft keyboard on a custom manually coded text field. I use the following code and I get the standard keyboard with a return character at the bottom right.

inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);

I would like to display the keyboard that has the OK (or perhaps it's DONE) in the bottom right. When I did some research I found that the inputType can be set on the EditText (which I'm not using in this case), but not for the view i'm using (GLSurfaceView).

Any ideas how I can get the alternative keyboard showing?

EDIT I tried the solution posted here: - Multiline EditText with Done SoftInput Action Label on 2.3 but unfortunately it didn't show the DONE button (I am on Android 2.1). I tried changing the inputType field and that did change the type (i tried "phone"), but not the DONE button.

Thanks for your help.

like image 955
Ash McConnell Avatar asked May 06 '11 11:05

Ash McConnell


1 Answers

If you want to obtain Done button on soft keyboard, you should set the "Ime options" of EditText field to actionDone

<EditText android:text="EditText" android:layout_width="fill_parent"
android:id="@+id/editText1" android:layout_height="wrap_content"
android:imeOptions="actionDone"/>
like image 75
woodshy Avatar answered Sep 23 '22 21:09

woodshy