我希望我的 APP 只能垂直运行,但我不能,我已经实现了以下但没有成功。
显现:
< application
...
android:configChanges="orientation"
android:screenOrientation="portrait">
锻炼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
...
android:orientation="vertical">
在您的文件
Mainfest.xml
中找到要在给定轮换中阻止的活动的标签。您需要添加到所有活动中,而不仅仅是一个,即为您的所有活动设置此:
解释:
另一种方法是:
setRequestedOrientation()
如下所示使用: