简体   繁体   中英

Android show input always in Orientation.portrait

I would like to show the input ALWAYS ((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE))

when I am in:

Configuration.ORIENTATION_LANDSCAPE mode

AFTER enter is clicked or Send is clicked on the input.

I tried this:

if (event != null && 
    event.getKeyCode() == KeyEvent.KEYCODE_ENTER && 
    event.getAction() == KeyEvent.ACTION_DOWN) {
    if (Screen.getScreenOrientation(mycontext) == Configuration.ORIENTATION_LANDSCAPE) 
        Utils.hideInput(mycontext, EditTextSend);
    else
        Utils.showInput(mycontext, EditTextSend);

But that is not working for me. Is it possible to not hide the input only when the user click back ?

我的解决方案很简单:

return true;

You can control keyboard visibility per Activity in your manifest , check out: http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft

To display the keyboard always use:

<activity android:windowSoftInputMode="stateAlwaysVisible" ... />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM