我有一个使用第三个库的应用程序。在我的主应用程序中,我禁用了所有活动以横向显示,但是一旦应用程序转到第三个库中的活动,它就会允许屏幕处于横向模式。
android:screenOrientation="portrait"
无论如何我可以从主应用程序中禁用它吗?
谢谢。
从清单中的所有活动中删除android:screenOrientation="portrait"
,并仅在应用程序 XML 标记中设置它。
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:screenOrientation="portrait">
......
.....
...
..
.
</application>
如果您希望应用中的某些活动既是横向又是纵向的,则可以覆盖要同时为纵向和横向的特定活动中的 screenOrientation 属性。