android studio開發工具升級到3.6.0以後,android:screenOrientation=“portrait” 一直警告報紅

一般有兩種解決方案,都是可行的:

第一種方案:

在AndroidManifest.xml中設置activity豎向,一般都是直接設置android:screenOrientation="portrait",升級gradle後這裏會有警告,提示Expecting android:screenOrientation="unspecified",雖然app運行沒問題但看着也很不爽。
解決方法:
在application標籤裏,加入tool:ignore="LockedOrientationActivity"這句話,manifest標籤裏引入toolxmlns:tool="http://schemas.android.com/tools"

 

第二種方案:參考(https://blog.csdn.net/mp624183768/article/details/104548332/

將Android Sutdio升級到了3.6.0。現在,我的Manifest.xml文件中出現以下錯誤。

Expecting 'android:screenOrientation="unspecified"' or '"fullSensor"' for this activity so the user can use the application in any orientation and provide a great experience on Chrome OS devices.

此活動需要'android:screenOrientation =“ unspecified”'或'“ fullSensor”',以便用戶可以在任何方向使用該應用程序,並在Chrome OS設備上提供出色的體驗

我應該將其轉換爲“ fullSensor”嗎?我如何擺脫這個問題?

這是一種警告,告知開發人員對於大屏幕設備,限制方向是不好的。但是,如果您的應用程序僅支持縱向模式,則可以通過執行以下操作禁用此警告。Mac:Android Studio->“偏好設置”->搜索Chrome(我已經附上了相同的屏幕截圖)->取消選中“活動已鎖定到某個方向”->應用並確定。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章