首页 > 解决方案 > Android studio 3.6 给 android:screenOrientation="portrait" 加红线,需要更改 android:screenOrientation="fullSensor" 吗?

问题描述

当我更新 android studio 3.6 时,它在下面给我一条红线android:screenOrientation="portrait"

它的说法是改变为android:screenOrientation="fullSensor"

谁能知道它背后的原因是什么?

标签: androidandroid-manifestandroid-studio-3.6

解决方案


在 Android Studio 3.6.0 中,我猜他们希望用户处理方向并鼓励开发人员使用 ViewModel 的东西。让我详细解释一下 screenOrientation

android:screenOrientation="portrait"

会给你错误你必须指定

android:screenOrientation="fullSensor" or android:screenOrientation="unspecified"

fullSensor 表示您是否已打开“旋转关闭”,否则它将根据您移动手机而改变方向

未指定表示如果您打开了旋转关闭,那么它将仅保持该方向,如果没有,则它将根据您移动手机而改变方向。


推荐阅读