简体   繁体   English

Android屏幕方向:强制横向?

[英]Android screen orientation: forcing landscape?

When I switch to a certain activity, I want that activity to show up in landscape mode. 当我切换到某个活动时,我希望该活动以横向模式显示。

In my XML for that actvitiy: 在该活动的XML中:

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 固定:代码必须在特定活动下的清单中

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. 它会为您处理更多事情。

固定:代码必须在特定活动下的清单中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM