Only fullscreen activities can request orientation闪退问题unity解决方案

度娘搜索下关键字,能出现好多个解决方案,我也是看了他们的然后改进的。

大佬1:https://www.jianshu.com/p/d0d907754603 

大佬2:https://blog.csdn.net/starry_eve/article/details/82777160

我的问题出现在给游戏接魅族SDK的时候,在小米5手机(系统android8.0.0)上登录闪退,当然看闪退日志就是标题。

对接魅族SDK要求配置很多个activity,如

<activity
        android:name="com.xxx.xxx.loader.a.ActivityN1NRNTS2"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:exported="false"
        android:screenOrientation="sensorLandscape"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />

这些activity在魅族SDK的依赖jar中,那么这里就不能使用大佬2的解决方案。

再看这个theme在android sdk目录下的,那么这里也不能直接使用大佬1的解决方案。

参考大佬1,修改如下

在res/style.xml中加入下面配置(第二个item也可以不要)

<style name="Meizu_Translucent_Theme" parent="@android:style/Theme.Translucent.NoTitleBar">
    <item name="android:windowIsTranslucent">false</item>
    <item name="android:windowDisablePreview">true</item>
</style>

然后修改activity配置

<activity
        android:name="com.jspdk.mtx.mz.loader.a.ActivityN1NRTS2"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:exported="false"
        android:screenOrientation="sensorLandscape"
        android:theme="@style/Meizu_Translucent_Theme" />

导致的问题也很明显,就是本来是一个透明的activity,结果变成了黑屏的activity。

还有就是,这里删除android:screenOrientation="sensorLandscape"也没用,因为:Activity的风格为透明,如果调用setRequestedOrientation方法固定方向,则crash。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值