问题描述
我想创建一个Android应用程序(一个片)应该只显示在横向例如,该应用程序应该忽略旋转90°,而是180°旋转支持
I would like to create an Android app (for a tablet) that should be only displayed in landscape orientation, e.g. the app should ignore rotations by 90°, but support rotations by 180°.
添加机器人:screenOrientation =山水,在清单导致应用程序忽略所有旋转,(即使是180°旋转),即通过180°旋转设备显示应用程序倒挂
Adding android:screenOrientation="landscape" in the manifest causes the app to ignore all rotations, (even the 180° rotations), i.e. rotating the device by 180° shows the application upside down.
如果没有安卓screenOrientation属性我的应用程序是正确的所有四个位置显示。旋转装置180°翻转的UI垂直RESP。水平。
Without the android:screenOrientation attribute my app is displayed "correctly" in all four positions. Rotation the device by 180° flips the UI vertically resp. horizontally.
在轮换将创建下列日志信息设备(也许这可以帮助?):
When rotation the device the following log messages are created (maybe this helps?):
[...]: INFO/WindowManager(1290): Setting rotation to 1, animFlags=0
Rotation is a value between 0 and 3 representing the current orientation.
总结:是否有可能使一个应用程序来支持景观取向
Summarized: Is it possible to enable an app to support both landscape orientations?
推荐答案
新的sensorLandscape屏幕方向显然是指用于此目的。
The new sensorLandscape screen orientation is apparently meant for this purpose.
例如,你可以这样做:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
不幸的是,这仅仅是作为安卓2.3。目前,我正在寻找一种方式来实现这一目标的升级Froyo。
Unfortunately, this is only available as of Android 2.3. I'm currently looking for a way to achieve this on Froyo.
这篇关于安卓:180°90°旋转关闭,但启用轮换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!