Android 8.0 Only fullscreen activities can request orientation

问题描述:

1.点击悬浮球的编辑按钮崩溃,会遇到类似这样错误信息: Only fullscreen activities can request orientation.

解决办法:

1.自定义一个主题,参考:

<style name=“BugtagsTheme”>        
    <item name="android:windowBackground">@color/transparent</item>         
    <item name="android:colorBackgroundCacheHint">@null</item>         
    <item name="android:windowDisablePreview">true</item>         
    <item name="android:windowNoTitle">true</item>         
    <item name="android:windowContentOverlay">@null</item>         
    <item name="android:windowIsTranslucent">false</item>     
</style>

2.使用 tools:replace 工具,在你项目的 AndroidManifest.xml 修改主题:

<activity
    android:name="com.bugtags.library.BugtagsActivity"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:theme="@android:style/BugtagsTheme”
    tools:replace=“@android:theme"            
/>