在整个应用程序的Andr​​oid编程方式禁用屏幕旋转应用程序、屏幕、方式、在整个

2023-09-07 02:24:13 作者:風吹柳絮飛

在整个应用程序的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>
 
精彩推荐
图片推荐