一、在 drawable 中创建一个 xml 文件:splah.xml
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/app_welcom_bg1"
android:dither="true"
android:filter="true"
android:antialias="true"
android:gravity="center">
</bitmap>
传送门:BitmapDrawable (可控制对齐平铺的图像)
二、设置启动页主题
<!--***************启动页Theme***************-->
<style name="Theme.welcome" parent="AppTheme">
<item name="android:windowFullscreen">true</item>
<item name="android:background">@drawable/splah</item>
<item name="android:windowBackground">@color/common_color_white</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
</style>
设置 splah.xml 为启动页背景,设置 windowBackground 为白色,防止图片大小小于页面大小时出现黑边。