就像你管..最初他们显示图标屏幕而不是白屏。并在 2 秒后显示主屏幕。
首先在 res/drawable 中创建一个 XML drawable。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/gray"/>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher"/>
</item>
</layer-list>
接下来,您将在主题中将此设置为启动活动的背景。导航到您的 styles.xml 文件并为您的启动活动添加一个新主题
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/background_splash</item>
</style>
</resources>
在您的新 SplashTheme 中,将窗口背景属性设置为您的 XML 可绘制对象。在 AndroidManifest.xml 中将其配置为启动活动的主题:
<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
此链接提供您想要的。一步一步的程序。
https://www.bignerdranch.com/blog/splash-screens-the-right-way/
更新:
layer-list 可以像这样更简单(它也接受用于居中徽标的矢量可绘制对象,与 <bitmap> 标签不同):
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Background color -->
<item android:drawable="@color/gray"/>
<!-- Logo at the center of the screen -->
<item
android:drawable="@mipmap/ic_launcher"
android:gravity="center"/>
</layer-list>