錯誤描述:
Only fullscreen opaque activities can request orientation
只有全屏不透明的Activity可以請求方向
錯誤原因:
在android8的機(jī)器上,設(shè)置了橫豎屏屬性android:screenOrientation="portrait",又設(shè)置了activity的主題為透明android:theme="@style/myTransparent",沖突了,兩種屬性只能設(shè)置一種。
解決:
1、在AndroidManifest.xml中去掉activity方向的設(shè)置,
android:screenOrientation="portrait"
2、針對報錯的activity,設(shè)置activity的theme為非透明
如果一定要設(shè)置screenOrientation屬性,
在values-v26下的style設(shè)置屬性不透明
<style name="aa" parent="bb">
<item name="android:windowBackground">@color/white</item>
</style>
3、直接禁用preview window的樣式,這樣處理后,點擊圖標(biāo)就沒那么快顯示UI,需要等待時間久點。
<style name="aa" parent="bb">
<item name="android:windowDisablePreview">true</item>
</style>