Android Splash Screen

by Mir Suhail


An Android app takes some time to to start up, especially the first time the app is run on a device (also called as cold start). The splash screen may display start up progress to the user, or usually it may display branding information to identify and promote the application.

Here we will cover one of the techniques to implement the splash screen in an android app. We will learn how to,

  • Create a drawable resource file for the splash screen.
  • Define a new theme that will be used to display the drawable resource file.
  • Add a new Activity to the android application that will be used as the splash screen defined by the theme created in the last step.


Splash Screen View


Here, we assume that the app targets Android API level 15 (Android 4.0.3) or higher. The easiest way of rendering and displaying the splash screen is by creating a custom theme in styles.xml file and apply it to an Activity that exhibits the splash screen. When that Activity is rendered, it loads the theme and applies drawable resource (referenced by the theme) to its background. Here, we don’t need to create an additional layout file.

Creating drawable file

To create the drawable file, copy and paste the following code in drawables/my_splash.xml inside res directory.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="">

This layer-list will center the splash screen image splash_image.png on a background specified by the@color/gray resource.

Implementing the Theme

Next, we will create a theme for the splash screen. In styles.xml, copy and paste the following code.

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->

    <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
        <item name="android:windowBackground">@drawable/my_splash.xml</item>

Next we will configure this as our splash activity’s theme in the AndroidManifest.xml file

        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />

Defining the SplashActivity

Below is our  SplashActivity. This actvity does nothing but just forwards us to the MainActivity.

public class SplashActivity extends AppCompatActivity {
    private final int SPLASH_DISPLAY_LENGTH = 2000;
    protected void onCreate(Bundle savedInstanceState) {
        new Handler().postDelayed(new Runnable(){
            public void run() {
                /* Create an Intent that will start the Main Activity. */
                Intent mainIntent = new Intent(SplashActivity.this,MainActivity.class);

Notice that we don’t even set up a view for this SplashActivity. The view comes from the theme. When we set up UI for our splash activity in the theme, it is available immediately. Thus, we have implemented the splash screen in our app to give it a more professional look. Try it!


Leave a Reply

Your email address will not be published. Required fields are marked *

Mobile Research Apps

We have deep expertise in design and development of mobile research apps that work on both iOS and Android securely.

Contact us now

Popular Posts