如何删除闪屏前出现的白屏?

Kru*_*iya 4 performance android splash-screen android-layout

打开Java文件时,我首先看到空白的白色屏幕,然后显示启动屏幕布局。我的java文件为:

new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    //Task 
                    finish();
                }
              }, ARG_SPLASH_TIME);
Run Code Online (Sandbox Code Playgroud)

xml文件中,我只需放置ImageView并设置android:src值。在manifest文件中,我以启动器模式打开Splash活动。

Kru*_*iya 6

终于以正确的方式得到了我的答案。我只是跟随。

在values-> styles.xml中,我创建了初始屏幕背景图像

<style name="AppTheme.Splash" parent="AppTheme.NoActionBar">
    <item name="android:windowBackground">@drawable/splash</item>
</style>
Run Code Online (Sandbox Code Playgroud)

对于api 19以下,在values-19-> styles.xml中,我使用了

<style name="AppTheme.Splash" parent="AppTheme.NoActionBar">
    <item name="android:windowBackground">@drawable/splash</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
</style>
Run Code Online (Sandbox Code Playgroud)

setContentview()从SplashActivity中删除并在Manifest.xml文件中添加了初始屏幕样式android:theme="@style/AppTheme.Splash"