Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I remove white screen which appear before splash screen?

While opening java file I first look blank white screen, and after that it appears me splash screen layout. I have java file as:

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

And in xml file I simply put ImageView and set android:src value. In manifest file I open Splash activity in Launcher Mode.

like image 846
Krunal Kapadiya Avatar asked Nov 28 '22 06:11

Krunal Kapadiya


1 Answers

Finally got my answer Splash Screen in Right Way. I do just following.

In values->styles.xml I created splash screen background image

<style name="AppTheme.Splash" parent="AppTheme.NoActionBar">
    <item name="android:windowBackground">@drawable/splash</item>
</style>

For below api 19, in values-19->styles.xml I used

<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>

I removed setContentview() from SplashActivity and added style for splash screen in Manifest.xml file android:theme="@style/AppTheme.Splash"

like image 160
Krunal Kapadiya Avatar answered Dec 04 '22 15:12

Krunal Kapadiya