错误日志:
Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation
字面意思就是说:只有不透明的全屏activity可以自主设置界面方向。
网上搜了搜,发现不是个例,这个问题出现在android8.0以上。原因是我们给Activity同时设置了 android:screenOrientation="" 和 <item name="android:windowIsTranslucent">true</item>。
没办法,解决适配呗(-_-)。
解决办法:删除AndroidManifest中相应Activity的 android:screenOrientation=""属性;或者删除相应Activity的theme中<item name="android:windowIsTranslucent">true</item>属性。
二者只留其一,若两种效果都需要,只能另辟蹊径了。
转载于:https://blog.csdn.net/qq_28484355/article/details/79125651