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.
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With