Android: make a splash screen until the app is ready

In Android it’s easy to make a splash screen not time based, but showed only until the application is not ready. First of all we have to create a drawable xml file. This file will be the splash screen.

Then we have to set it into our own theme, in the styles.xml file. For example, like this:

Now you can try to set the theme in the manifest.xml (android:theme=”@style/AppTheme” under the application tag) and launch the application! If you try you can see that the image is still showed as your application background; it’s not very nice. Here you have two ways to restore your normal background.

  1. Create a second different theme in the styles.xml with the android:windowBackground wanted. Then set the theme in the activity.
  2. In the activity set the drawable window, maybe useful if it’s a single color.

That’s all! Enjoy your splash screen!

Share
Questo articolo è stato postato in Android