Android 处理启动页(Splash)白屏问题,做一下记录:
一、在drawable文件夹下的一个定义样式中使用的xml背景splash_bg.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<bitmap android:gravity="fill" android:src="@drawable/white" />
</item>
<item>
<bitmap android:gravity="center" android:src="@drawable/splash" />
</item>
<item>
<bitmap android:gravity="bottom|center" android:src="@drawable/splash_bottom" />
</item>
</layer-list>
二、定义样式@style/Theme.Splash:
<style name="Theme.Splash" parent="@style/AppTheme">
<item name="android:windowBackground">@drawable/splash_bg</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowAnimationStyle">@style/noAnimation</item>
<item name="android:windowFullscreen">true</item>
</style>
三、最后在AndroidManifest.xml引用:
android:theme="@style/Theme.Splash</span>"
虽然看起来的挺简单的,但是处理了白屏问题后,可以明显的提高用户的体验性!