在整个应用程序的Andr​​oid编程方式禁用屏幕旋转 [英] Programatically disabling screen rotations in entire application Android

查看:91
本文介绍了在整个应用程序的Andr​​oid编程方式禁用屏幕旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在整个应用程序的Andr​​oid编程方式禁用方向

Programatically disabling orientation in entire application Android

推荐答案

作为保持它在纵向或横向无论哪种方式的设备倾斜? 您需要将它添加到你的清单,你要限制活动里面

As in keep it in portrait or Landscape no matter which way device is tilted? You need to add this to your manifest inside the activity that you want to limit

 android:screenOrientation="portrait" //Or landscape for horizontal.

如果你想要不同的活动只是让你的清单看起来是这样的。

If you want it different between activities just make your manifest look like this.

        <activity android:name=".Activity1" 
        android:screenOrientation="landscape">       
        </activity>

        <activity android:name=".Activity2" 
        android:screenOrientation="portrait">
        </activity>

        <activity android:name=".Activity3" 
        android:screenOrientation="landscape">
        </activity>

这篇关于在整个应用程序的Andr​​oid编程方式禁用屏幕旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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