Keyboard is hidden on orientation change

巧了我就是萌 提交于 2020-01-04 06:48:47

问题


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


回答1:


Add this on your code

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



回答2:


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

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




回答3:


Hi can you try AndroidManifest.xml

android:windowSoftInputMode="stateAlwaysVisible" put this.




回答4:


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.



来源:https://stackoverflow.com/questions/6027578/keyboard-is-hidden-on-orientation-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!