在纵向或纵向反转活动只 [英] Activity in portrait or reverse portrait only

查看:198
本文介绍了在纵向或纵向反转活动只的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的活动,只在纵向模式下可用 - 纵向和reversePortrait。我怎样才能做到这一点?当我设置安卓screenOrientation =画像这将迫使活动只有在正常的肖像 - 反之亦然reversePortrait。

请不要告诉我,这是一个不错的办法,迫使/锁方向。我知道这件事情,但还是客户端请求的。感谢您的理解和任何想法。

更新: API级别11和更高

解决方案

如果您在API层面9+,使用安卓screenOrientation =sensorPortrait

  

肖像取向的,但可以是正常或反向肖像   基于设备传感器。新增的API级别9。

<一个href="http://developer.android.com/guide/topics/manifest/activity-element.html#screen">Documentation

I want my activity to be available only in both portrait modes - portrait and reversePortrait. How can I achieve this? When I set android:screenOrientation="portrait" it will force activity to be only in normal portrait - vice versa with reversePortrait.

Please, don't tell me it's a bad approach to force/lock orientation. I know about it, but still client is requesting it. Thanks for understanding and for any ideas.

UPDATE: API Level 11 and higher

解决方案

If you are on API level 9+, use android:screenOrientation="sensorPortrait".

Portrait orientation, but can be either normal or reverse portrait based on the device sensor. Added in API level 9.

Documentation

这篇关于在纵向或纵向反转活动只的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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