三种方法:
1.设置主题背景透明,微信就是用此办法,在主题样式中加入
<item name="android:windowIsTranslucent">true</item>
缺点:冷启动点击了要等一会才有反应,给人感觉启动慢,在8.0的机子上,如何你还设置了Activity的禁止横屏选项会报错:Only fullscreen activities can request orientation,所以8.0最好不要用此方法
2.在启动页的 super.onCreate(savedInstanceState);方法前加入
getWindow().getDecorView().setBackgroundResource(R.drawable.index_bg);
缺点:还是有白屏,不过白屏时间大大缩短
3.写个样式,然后加入到启动页
<style name="NoWhiteBgTheme" parent="AppTheme">
<item name="android:windowBackground">@drawable/index_bg</item>
</style>
在Androidmanifest.xml中的页面配置
<activity android:name=".IndexActivity" android:theme="@style/NoWhiteBgTheme">
缺点:还是有白屏,不过白屏时间缩短一些,没有方法2简洁