简体   繁体   English

Android始终在Orientation.portrait中显示输入

[英]Android show input always in Orientation.portrait

I would like to show the input ALWAYS ((InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE)) 我想始终显示输入((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 您可以在manifest控制每个Activity键盘可见性,请查看: http : //developer.android.com/guide/topics/manifest/activity-element.html#wsoft

To display the keyboard always use: 要显示键盘,请始终使用:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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