开发者

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 charact开发者_如何学运维er 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.


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"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜