Android sensorPortrait 不适用于反向肖像模式

Muj*_*eeb 5 android portrait screen-orientation android-sensors

我试图让我的应用程序仅在纵向和反向纵向模式下工作(而不是横向)。这是我的应用程序的 SDK 详细信息

minSdkVersion 15
targetSdkVersion 23 
Run Code Online (Sandbox Code Playgroud)

在 AndroidManifest.xml 文件中,我在每个活动标签中都有以下行

android:screenOrientation="sensorPortrait"
Run Code Online (Sandbox Code Playgroud)

我尝试了很多其他答案,但没有一个对我有用。请帮我解决这个问题。谢谢。

KAl*_*lO2 0

看来这是一个未解决的错误。 https://issuetracker.google.com/issues/207403736

当我设置 android:screenOrientation="sensorLandscape" 时,它的行为符合预期。当我设置 android:screenOrientation="sensorPortrait" 时,在我的手机翻转后,它不会将方向更改为reversePortrait。当我设置 android:screenOrientation="portrait" 时,它可以做出正确的方向。