Android 在后续活动中轮换配置

Android 在后续活动中轮换配置,android,android-layout,Android,Android Layout,MainActivity和应用程序的大多数活动使用: android:configChanges="orientation" android:screenOrientation="portrait" 防止屏幕旋转。但在其中一个活动中,我希望它能够旋转,尽管它没有配置变化,也没有屏幕方向,但它不能旋转 android:configChanges="orientation" android:screenOrientation="portrait" 似乎configChanges和screenOr

MainActivity和应用程序的大多数活动使用:

android:configChanges="orientation"
android:screenOrientation="portrait"
防止屏幕旋转。但在其中一个活动中,我希望它能够旋转,尽管它没有配置变化,也没有屏幕方向,但它不能旋转

android:configChanges="orientation"
android:screenOrientation="portrait"
似乎configChanges和screenOrientation是从主活动继承来的,因为如果我对主活动的行进行注释,那么其他活动就可以轮换

android:configChanges="orientation"
android:screenOrientation="portrait"

为什么会这样?如何在某些活动中防止旋转而在其他活动中允许旋转?

如果未设置特定的
android:screenOrientation
值,默认值将为
“未指定”
(描述为“默认值。系统选择方向。它使用的策略以及在特定上下文中所做的选择可能因设备而异。”中)

android:configChanges="orientation"
android:screenOrientation="portrait"
我建议将您的特殊活动设置为
“sensor”
,看看这是否会产生影响

android:configChanges="orientation"
android:screenOrientation="portrait"