键盘在方向更改时隐藏

时间:2011-05-17 07:25:42

标签: android keyboard orientation-changes

当Android手机的方向变为横向时,我的键盘被隐藏。我该怎么做以显示我的键盘?

4 个答案:

答案 0 :(得分:3)

在您的代码中添加此内容

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

答案 1 :(得分:2)

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

将此内容放入类文件中的 onCreate() onResume()

答案 2 :(得分:0)

试试这个:

 InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
 imm.showSoftInputFromWindow(enterChat.getWindowToken(), 0);

 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

这将使您的键盘始终可见。在这里,我使用了enterchat editText。你不需要我想的那样。

答案 3 :(得分:0)

您可以试试AndroidManifest.xml

android:windowSoftInputMode="stateAlwaysVisible"放了这个。

相关问题