Android的屏幕方向:强迫景观? [英] Android screen orientation: forcing landscape?

查看:189
本文介绍了Android的屏幕方向:强迫景观?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我切换到一定的活动,我希望这样的活动,以在横向模式下显示出来。

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

在我的XML为actvitiy:

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.

固定:
需要code是在清单中的具体活动在

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

推荐答案

在您的活动标签,而不是只:

In your activity tag, instead of just:

android:screenOrientation="landscape"

我会设置:

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

这需要照顾的一些事情给你。

It takes care of a few more things for you.

这篇关于Android的屏幕方向:强迫景观?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆