Skip to main content

How to create a splash screen in Kotlin Android

How to create a splash screen in Kotlin Android.

Here is a detailed step-by-step tutorial on how to create a splash screen in Kotlin Android:

Step 1: Create a new Android Project

Start by creating a new Android project in Android Studio. Choose an appropriate project name and package name for your application.

Step 2: Design the Splash Screen Layout

In the res/layout folder, create a new XML file called "activity_splash.xml" to define the layout for the splash screen. Customize the layout as per your requirements. For example, you can use an ImageView to display a logo or background image.

<RelativeLayout xmlns:android=""

android:scaleType="centerCrop" />


Step 3: Create a Kotlin Class for Splash Screen

In the Kotlin package of your project, create a new Kotlin class called "SplashActivity". This will be the activity that will display the splash screen.

class SplashActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {

// Add any additional setup code here

// Start the next activity after a certain delay
}, 2000) // Delay in milliseconds

Step 4: Modify the AndroidManifest.xml

Open the AndroidManifest.xml file and add the following code to define the SplashActivity as the launcher activity.

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

Step 5: Add the Splash Screen Image

In the res/drawable folder, add the splash image that you want to display during the splash screen. Make sure the image is named "splash_image" and has the appropriate file extension (e.g., splash_image.png).

Step 6: Build and Run the App

Build and run your Android app on an emulator or a physical device. The splash screen will be displayed for the specified delay (2000 milliseconds in this example), after which it will automatically transition to the MainActivity.

That's it! You have successfully created a splash screen in Kotlin Android. You can customize the duration of the splash screen and add any additional setup code as per your requirements.