当前位置:   article > 正文

android8.0报错:java.lang.IllegalStateException: Only fullscreen opaque activities can request orientat_illegalstateexception only fullscreen opaque activ

illegalstateexception only fullscreen opaque activities can request orientat

解决方法

第一步,在styles.xml文件中添加如下样式


    <style name="myTranslucent" parent="AppTheme">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:windowIsTranslucent">false</item>
        <item name="android:windowAnimationStyle">@android:style/Animation</item>
    </style>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

关键是要添加这一条:

<item name="android:windowIsTranslucent">false</item>
  • 1

第二步,在activity上应用此样式

<manifest>
...
    <application>
    ....
        <activity
            android:name=".chatui.ui.activity.FullImageActivity"
            android:configChanges="orientation|keyboardHidden|navigation|screenSize"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden|adjustPan"
            android:theme="@style/myTranslucent" />
    </application>
</manifest>


  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

关键是这一条:

android:theme="@style/myTranslucent"
  • 1

问题解决!!!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/375923
推荐阅读
相关标签
  

闽ICP备14008679号