键盘在方向更改时隐藏

问题描述:

当android手机的方向更改为横向时,我的键盘被隐藏。我应该怎么做才能显示我的键盘?键盘在方向更改时隐藏

试试这个:

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

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

这会让你的键盘总是可见。在这个enterchat是我使用过的editText。你不需要我想的那件事。

添加这对你的代码

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

你好你可以试试AndroidManifest.xml中

android:windowSoftInputMode="stateAlwaysVisible"把这个。在类文件

+0

我已经在我的清单,但它不工作.. :( – CMA 2011-05-17 07:41:09

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

把这个的onCreate()的onResume()