Android 启动页黑屏适配
方案一 《推荐方案》
1.给启动加添加如下配置
<style name="SplashTheme" parent="AppTheme">
//启动页黑屏适配
<item name="android:windowBackground">@drawable/splash_img</item>
<item name="android:fitsSystemWindows">false</item>
//状态栏颜色
<item name="colorPrimaryDark">@color/base_color</item>
</style>
2.splash_img代码如下
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="@color/base_color"/>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/splash"/>
</item>
</layer-list>
3.给启动页添加background
android:background="@drawable/splash_img"
方案二 《不推荐》
这种方案是把黑屏时间变成了等待时间,体验效果极差,
<style name="SplashTheme" parent="AppTheme">
<item name="android:windowDisablePreview">true</item>
</style>