Skip to content

Niyander Tech

Learn with fun

Menu
  • Home
  • Categories
    • Android
    • Alpine.js Components
    • Genshin Impact News
    • Jobs and Internship
    • Coursera Hub
  • Our Policies
    • Privacy Policy
    • Terms and Conditions
    • Contact Us
  • Coursera Search Engine
  • AI Tools
    • AI Background Remover
    • AI Video Downloader
    • 98+ Beautiful CSS Box-Shadow
    • G-Drive Download Link Generator
Menu
Splash Screen in Android

Splash Screen in Android

Posted on December 4, 2020September 6, 2024 by Niyander

How to Create a Splash Screen in Android Studio

In this blog Post, I’m going to guide you on how to create a splash screen in Android Studio. A splash screen is a screen that appears when you open an app, typically displaying a logo or a brand name before the main content loads. This is a great way to enhance the user experience and provide a professional touch to your app.

 

Step-by-Step Guide to Create a Splash Screen

 

Step 1: Create a New Project

  • First, start by creating a new Android project in Android Studio. Name the project as Splash and choose an Empty Activity.

Step 2: Add Your Logo to the Project

  • Copy your logo image into the drawable folder.
  • Ensure the image is in either .png or .jpg format to be compatible with Android Studio.

Step 3: Create a Splash Activity

  • Navigate to the java folder under com.example.splash.
  • Right-click on the package, and select New > Activity > Empty Activity.
  • Name the activity SplashActivity.

Step 4: Modify the AndroidManifest.xml

To make the splash screen the launcher activity, you need to adjust the AndroidManifest.xml file. Replace the launcher activity with the new SplashActivity.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.splash">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Splash">

<activity android:name=".SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name=".MainActivity" />

<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>
</manifest>

In the above code, the SplashActivity is now set as the launcher activity, which will be displayed first when the app starts.

 

Step 5: Design the Splash Screen Layout

Now, let’s design the layout for the splash screen by creating the activity_splash.xml file in the res/layout folder. Here’s the code for the layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SplashActivity">

<ImageView
android:id="@+id/imageView"
android:layout_width="203dp"
android:layout_height="207dp"
android:layout_centerInParent="true"
app:srcCompat="@drawable/logos"
tools:srcCompat="@drawable/logos" />

<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:layout_marginBottom="136dp"
android:fontFamily="@font/artifika"
android:text="Animi World"
android:textSize="36sp"
android:textStyle="bold" />
</RelativeLayout>

 

This layout includes:

  • An ImageView for the logo.
  • A TextView for the brand name.

Step 6: Add Logic to the Splash Screen

Now let’s write the logic for the splash screen in SplashActivity.java. The goal is to display the splash screen for 3.5 seconds before transitioning to the main activity.

package com.example.splash;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;

public class SplashActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
getSupportActionBar().hide(); // Hides the ActionBar for the splash screen

// Creating a new thread to handle the delay
Thread thread = new Thread() {
public void run() {
try {
// Delay of 3.5 seconds (3500 milliseconds)
sleep(3500);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
// Start the MainActivity after the splash screen
Intent openMain = new Intent(SplashActivity.this, MainActivity.class);
startActivity(openMain);
finish(); // Close the splash screen so that the user cannot return to it
}
}
};
thread.start();
}
}

 

In this code:

  • A thread is used to pause the app for 3.5 seconds.
  • After the delay, the app transitions to MainActivity.

Step 7: Run the App

Now, build and run your app. You should see the splash screen with your logo and brand name for 3.5 seconds before it navigates to the main activity.

 

 

Category: Android

Post navigation

← Add Two Number Program app in Android Studio
Quotes app using android Studio →

Leave a Reply Cancel reply

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

Notice

Hey guys! Need a Google Drive Direct Download Link Generator? I made a simple tool that does just that. 🚀
Convert any shared Drive link into a direct download link instantly.
Try it out now: https://niyander.com/projects/tools/gdrive/
Let me know your thoughts!

Notice

Hi everyone! I've built a collection of 98+ CSS Box-Shadow Examples for developers and designers! 🎨
Click on any card to copy the shadow — super handy for your projects.
Explore them all here: https://niyander.com/projects/tools/box-shadow/
Hope you find it useful!

Notice

Hey folks! Excited to share my new tool — an All-in-One Social Media Downloader! 📥
Download videos, photos, and audio from TikTok, YouTube, Instagram, Facebook, and more.
Check it out here: https://niyander.com/projects/tools/sm/
Your feedback is welcome!

Notice

Hey friends! I just launched a free AI Background Remover called Panda AI! 🐼
Easily remove backgrounds from images with just one click.
Try it out now: https://niyander.com/projects/tools/bg/
Let me know what you think!

May 2025
M T W T F S S
 1234
567891011
12131415161718
19202122232425
262728293031  
« Apr    

About

Greetings, Hey i am Niyander, and I hail from India, we strive to impart knowledge and offer assistance to those in need.

  • Alpine.js Components
  • Android
  • Bootstrap
  • Coursera Hub
  • Genshin Impact News
  • Jobs and Internship
  • Uncategorized

Hot Topics

  • Microsoft Azure Data Scientist Associate (DP-100) Quiz Answers + Review
  • Prepare for DP-100: Data Science on Microsoft Azure Exam Answers + Review
  • Genshin Impact Version 5.6 redeem codes
  • More Software Engineering Jobs in Japan for Expats – April 2025 Edition
© 2025 Niyander Tech | Powered by Minimalist Blog WordPress Theme