Member-only story

Animated Splash Screen with JetpackCompose

Make your app better

--

Photo by Izzy Gerosa on Unsplash

Splash screen (also known as launch screens or startup screen) is the screen that appears when you open an app on your mobile. This is used to provide a Brand introduction of your app or to provide a good user experience.

With the Latest Jetpack compose android provides its own splash API. But unfortunately, that will only work in Android 12 or higher. What about the other version?

Today I will write about a way to create a Splash screen that will support all the versions. Let’s start.

What Are We Reading

It’s great. Isn’t it? By the way, JC stands for Jetpack Compose 😃.

Add the Navigation

This code is pretty simple. We have two screen SplashScreen and MainScreen . startDestination set the SplashScreen as the first screen when the app opens.

We are using this function from MainActivity .

val navController = rememberNavController()
SetupAppNavigation(
navController = navController)

Create the design

This code is also simple. We are Just showing an icon (probably which will be your logo) and text in the center of the screen. We are using Box as a container. contentAlignment = Alignment.Center is responsible for keeping the icon and text in the center. The above code results in the below screen.

--

--

Farhan Tanvir
Farhan Tanvir

Written by Farhan Tanvir

Believes in learn by doing . Currently working as a software engineer. Love to share Knowledge. https://twitter.com/FarhanTanvirBD

Responses (2)

Write a response