Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation

Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation

Kornan
2021-02-23 / 0 评论 / 522 阅读 / 正在检测是否收录...

android 8.0 (API=26) 出现的问题

解决方法:

  1. 去掉android:screenOrientation;
  2. android:windowIsTranslucent 改为false; 如果需要透明的设置加上android:windowDisablePreview =true;
    在项目res目录下创建values-v26/styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme.Start" parent="AppTheme">
        <item name="android:windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
      
        <!-- 适配android手机系统8.0(api26),Only fullscreen opaque activities can request orientation -->
        <!--用背景图消除启动白屏-->
        <item name="android:windowBackground">@mipmap/background</item>
        <item name="android:windowIsTranslucent">false</item>
        <item name="android:windowDisablePreview">true</item>
    </style>
</resources>
0

评论

博主关闭了当前页面的评论