Keyboard is hidden on orientation change

2019-07-20 00:05发布

My keyboard is hidden when the orientation of the android phone changes to landscape. What should I do in order to show my keyboard?

4条回答
放我归山
2楼-- · 2019-07-20 00:25

Try this:

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

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

This will make your keyboard always visible. In this the enterchat is editText I have used. You don't need that thing i think.

查看更多
Ridiculous、
3楼-- · 2019-07-20 00:31
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

put this in onCreate() and onResume() in your class file.

查看更多
ら.Afraid
4楼-- · 2019-07-20 00:32

Hi can you try AndroidManifest.xml

android:windowSoftInputMode="stateAlwaysVisible" put this.

查看更多
萌系小妹纸
5楼-- · 2019-07-20 00:46

Add this on your code

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
查看更多
登录 后发表回答