keyboard disappears while orientation change to landscape mode

别等时光非礼了梦想. 提交于 2019-12-13 02:46:20

问题


I am enabling orientation change in focusChangeListener of an edittext in my app.

It is working fine, but the issue is if the user flips the keyboard to landscape mode keyboard disappears.

It will come up only if user tap on edittext again or change orientation to portrait mode.

I need to display keyboard in landscape mode without touching the edittext.

Please help me.


回答1:


Generally, its a bad idea to mess with the default IME behavior because there are devices out there with hardware keyboards.

Now, that you have been warned, listen for the orientation change and if the keyboard was visible before the change and there is no hardware keyboard on the device, show the keyboard manually.




回答2:


Try using android:configChanges="orientation" into your manifest class.

  <activity
        android:name=".classname"
        android:configChanges="keyboardHidden|orientation"

         >

if works then accept it.



来源:https://stackoverflow.com/questions/12003584/keyboard-disappears-while-orientation-change-to-landscape-mode

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