错误描述:
Only fullscreen opaque activities can request orientation
只有全屏不透明的Activity可以请求方向
错误原因:
在android8的机器上,设置了横竖屏属性android:screenOrientation="portrait",又设置了activity的主题为透明android:theme="@style/myTransparent",冲突了,两种属性只能设置一种。
解决:
1、在AndroidManifest.xml中去掉activity方向的设置,
android:screenOrientation="portrait"
2、针对报错的activity,设置activity的theme为非透明
如果一定要设置screenOrientation属性,
在values-v26下的style设置属性不透明
<style name="aa" parent="bb">
<item name="android:windowBackground">@color/white</item>
</style>
3、直接禁用preview window的样式,这样处理后,点击图标就没那么快显示UI,需要等待时间久点。
<style name="aa" parent="bb">
<item name="android:windowDisablePreview">true</item>
</style>