How to Create a Splash Screen

Ibukun Okunoye
The Startup
Published in
2 min readFeb 16, 2021
Photo by NeONBRAND on Unsplash

What’s a Splash screen?

It’s a start up screen that is displayed while an android app loads in the background. It can contain your app’s logo and/or name.

There are different ways of creating a splash screen like using timers with an extra activity, but this method can cause the splash screen to display more than necessary. Here, I’ll show you a more appropriate method, using the app’s launcher theme on Android Studio.

  • First we want to create a drawable resource file containing the logo and the background color. Add the file in the res/drawable folder.
Create a Drawable Resource File

Ensure you use a layer-list tag to contain your drawable files.

  • Next we want to define a theme for the splash screen in theme.xml (in the res/values/themes folder).
Open themes.xml

Here you specify your drawable resource file as your android:windowBackground. In this example, I’ll name my theme “splashScreenExampleTheme”.

  • Set the app’s the launcher theme to the splash screen theme in AndroidManifest.xml using android:theme in the application tag.
AndroidManifest.xml
  • Finally, in your main activity, set the launcher theme back to the app’s default theme, using thesetTheme() function before super.onCreate(savedInstanceState), like so…

Result…

And we’re done!

If you like this article, follow me for more! And leave your comments if you have any.

--

--