Reputation: 5
I've set a splash screen on my app using this guide.
The background of my app is a transition color (changing color every few seconds using animation-list.
After the splash screen is shown (at the startup of the app), it stays in the background of the main activity.
This is spalsh_screen.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@android:color/white"/>
<item>
<bitmap
android:src="@drawable/talki_logo_big"
android:gravity="center"/>
</item>
</layer-list>
This is the animation_list.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:visible="true">
<item
android:drawable="@drawable/gradient_background_1"
android:duration="2500" />
<item
android:drawable="@drawable/gradient_background_2"
android:duration="2500" />
<item
android:drawable="@drawable/gradient_background_3"
android:duration="2500" />
<item
android:drawable="@drawable/gradient_background_4"
android:duration="2500" />
<item
android:drawable="@drawable/gradient_background_5"
android:duration="2500" />
</animation-list>
Is there a way to make the splash screen disappear?
Thanks! :)
Upvotes: 0
Views: 2204
Reputation: 58934
The solution is already there in the tutorial you linked.
The easiest way to transition back to your normal theme is to call
setTheme(R.style.AppTheme)
beforesuper.onCreate()
andsetContentView()
.
public class MyMainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// Make sure this is before calling super.onCreate
setTheme(R.style.Theme_MyApp);
super.onCreate(savedInstanceState);
// ...
}
}
You have set AppTheme.Launcher
in manifest, which gives a background to Activity. Now after Activity is started, you need to change that theme to your App theme to remove the Splash Background.
Upvotes: 2
Reputation: 544
Try to add the property android:noHistory="true"
in the manifest for your splashscreen activity.
A value of "true" means that the activity will not leave a historical trace. It will not remain in the activity stack for the task, so the user will not be able to return to it and maybe it won't show in the background.
Upvotes: 0