How to create a custom Splash Screen in Android Studio | Calendar App 2024 | Part – 05

In this blog, we provide a splash screen source code of a calendar app 2024 [Thakur Prasad Calendar 2024] designed a custom splash screen layout in Android Studio.

App Color Code Below:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="purple_200">#F3382A</color>
    <color name="purple_500">#F3382A</color>
    <color name="purple_700">#F3382A</color>
    <color name="teal_200">#151515</color>
    <color name="teal_700">#151515</color>
    <color name="black">#FF000000</color>
    <color name="white">#FFFFFFFF</color>
    <color name="light_background">#fff1e1</color>
</resources>

Create a Custom Splash Screen Layout.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    android:background="@color/light_background"
    android:fitsSystemWindows="true"
    tools:context=".MainActivity">

</androidx.constraintlayout.widget.ConstraintLayout>

Create an ImageView Layout.

<ImageView
        android:id="@+id/mainLogo"
        android:layout_width="248dp"
        android:layout_height="248dp"
        android:contentDescription="@string/app_name"
        android:elevation="2dp"
        android:src="@drawable/icon"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.25" />

Create a TextView Layout Design.

    <TextView
        android:id="@+id/developer_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="4dp"
        android:text="@string/made_with_click2code"
        android:textColor="@color/purple_200"
        android:textSize="14sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/mainLogo"
        app:layout_constraintVertical_bias="1" />

Create a LottieFile Animation ProgressBar Layout. Also, we provide you with a dependency for the LottieFile Animation View Progress Bar.

// LottieFile Dependency
    implementation("com.airbnb.android:lottie:6.1.0")

Now, we create a LottieFile AnimationView Progress Bar Layout.

    <com.airbnb.lottie.LottieAnimationView
        android:id="@+id/progressBar"
        android:layout_width="48dp"
        android:layout_height="48dp"
        app:layout_constraintBottom_toTopOf="@+id/developer_name"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/mainLogo"
        app:lottie_autoPlay="true"
        app:lottie_fileName="progress01.json"
        app:lottie_loop="true" />

Download LottieFile Animation View Progress Bar JSON File.

Create a Splash Screen Animation When the App Launch for the First Time named splash_animation.

<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="2000"
    android:fromAlpha="0.0"
    android:toAlpha="1.0">
    
</alpha>

Now, we have to create Splash Screen[JAVA] code, which means backend code in the MainActivity.java file.

Here, we create code from One Activity to Another Activity.

int splashTimeOut = 2500;
        new Handler().postDelayed(() -> {
            Intent intent = new Intent(MainActivity.this, HomeActivity.class);
            startActivity(intent);
            finish();

        }, splashTimeOut);
ImageView logoIMG = findViewById(R.id.mainLogo);
        LottieAnimationView lottieAnimationView = findViewById(R.id.progressBar);
        TextView develpoerName = findViewById(R.id.developer_name);

        Animation animation = AnimationUtils.loadAnimation(this, R.anim.splash_animation);
        logoIMG.startAnimation(animation);
        lottieAnimationView.startAnimation(animation);
        develpoerName.startAnimation(animation);
Scroll to Top