Android screen orientation: forcing landscape?

无人久伴 提交于 2019-12-11 14:53:50

问题


When I switch to a certain activity, I want that activity to show up in landscape mode.

In my XML for that actvitiy:

android:screenOrientation="landscape"

most tutorials stated this is all that's needed, yet when that activity is switched to it doesn't automatically change orientation.

fixed: the code needed to be in the manifest under the specific activity


回答1:


In your activity tag, instead of just:

android:screenOrientation="landscape"

I would set:

 android:screenOrientation="landscape" android:configChanges="orientation|keyboardHidden"

It takes care of a few more things for you.




回答2:


fixed: the code needed to be in the manifest under the specific activity



来源:https://stackoverflow.com/questions/21243189/android-screen-orientation-forcing-landscape

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