Step 1 - Create a new activity for your splash screen. In Android Studio, go to File > New > Activity > Empty Activity. Name the activity something like "SplashActivity".
Step 2 - Create the layout for your splash screen. In res/layout, create a new XML file and name it "activity_splash.xml". This will be the layout for your splash screen. Add any desired UI elements such as text or images.
Step 3 - In Android Studio, in Gradle script, build.gradle (Model. App) copy the code given below and paste it in Dependencies, then after pasting, click on Sync Now option.
def lottieVersion = "3.4.0"
implementation "com.airbnb.android:lottie:$lottieVersion"
Step 4 - Finally, add the Splash Activity to the manifest file. Copy the code given below and paste it in Android Manifest.XML .
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.ApkdNews"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="false" />
<activity
android:name=".SplashActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Step 5 - Now copy the code given below and paste it in Activity_Splash.xml, now if you want to change the photo or text, then you have to change it from.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
tools:context=".SplashActivity">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/animationView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:lottie_rawRes="@raw/hello"
app:lottie_autoPlay="true"
app:lottie_loop="true"/>
<ProgressBar
android:layout_width="220dp"
android:layout_height="10dp"
android:layout_gravity="center_horizontal"
style="?android:attr/progressBarStyleHorizontal"
android:max="100"
android:indeterminate="true"
android:progress="0"
android:layout_marginTop="100dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="43dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="Create By Apkd Videos"
android:textColor="#ED0808"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>
Also Read - How To Create Splash Screen Android Studio
Step 6 - Now copy the code given below and paste it in SplashActivity.Java , Now if you want to change the photo or text, then you have to change it from.
( Your Package Name )
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Window window = getWindow() ;
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_splash);
Thread splashTread = new Thread(){
@Override
public void run() {
try {
// You Can Change the time this place
sleep(3000);
startActivity(new Intent(getApplicationContext(),MainActivity.class));
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
super.run();
}
};
splashTread.start();
}
}
Also Read - How to Convert Any Website to Android App in Android Studio?
Step 4 - Now right click on res option in android studio and click on new option then click on android resource directory option then a pop box will open then type raw in directory name and select raw option in resource type below to do then click on OK. Then a raw folder will be created in Android Studio, after that whatever animation you want to apply, copy paste it in the Raw folder.
Step 6 - Now your Splash Screen With Animation is Complete Now you can run your codes and check.
Create Splash Screen Android Studio With Animation Watch YouTube Video -
Conclusion - All in all, a Splash Screen is a urgent piece of the client experience in an Android application. It fills in as a viewable signal that the application is stacking and gives an open door to the application to show its marking, logos, or other plan components. Making a Splash screen in Android Studio includes making a different action with a design that incorporates a picture or liveliness and setting a deferral for the screen to be shown. Customization of the Splash screen is conceivable with different plan components to suit the application's marking and client experience. Generally, the Splash screen assists with making a really captivating client experience, set the vibe for the application's plan, and give significant data to the client prior to sending off the fundamental movement of the application.