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>"
虽然看起来的挺简单的,但是处理了白屏问题后,可以明显的提高用户的体验性!
本文介绍了解决Android应用启动页出现白屏的方法。通过自定义splash_bg.xml背景文件,定义@style/Theme.Splash样式,并在AndroidManifest.xml中引用,有效避免了启动时的白屏现象,提升了用户体验。
476

被折叠的 条评论
为什么被折叠?



