首先在drawable中创建一个欢迎页welcome_bg_shape.xml
logo_welcome是启动页要放入的logo或者是一张图片也行,位置大家可以自己调
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
</shape>
</item>
<item
android:drawable="@drawable/logo_welcome"
android:gravity="center" />
</layer-list>
然后在复制代码到style中
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowFullscreen">true</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
<item name="android:windowBackground">@drawable/welcome_bg_shape</item>
</style>
清单文件中配置theme,然后就完美解决白屏问题
android:theme="@style/SplashTheme"