Read more" />

๐Ÿš€ Splash Screen in an Android App with Jetpack Compose and Material 3 ๐ŸŽจ

Implement a proper launch screen (splash screen) in a modern Android app built with Jetpack Compose and Material 3, following Googleโ€™s official recommendations.


1. Add the SplashScreen dependency

In your build.gradle (module):

implementation("androidx.core:core-splashscreen:1.0.0")

2. Define the XML theme for splash and post-splash

In res/values/themes.xml:

<resources>

    <!-- Base theme used after the splash -->
    <style name="Theme.MyApp" parent="Theme.Material3.DayNight.NoActionBar" />

    <!-- Splash theme showing the icon and background -->
    <style name="Theme.MyApp.Splash" parent="Theme.SplashScreen">
        <item name="windowSplashScreenAnimatedIcon">@drawable/ic_logo</item>
        <!-- For branding images
        <item name="android:windowSplashScreenBrandingImage">@drawable/ic_branding_logo</item> -->
        <item name="windowSplashScreenBackground">@color/white</item>
        <item name="windowSplashScreenAnimationDuration">500</item>
        <item name="postSplashScreenTheme">@style/Theme.MyApp</item>
    </style>

</resources>

3. Apply the splash theme in the AndroidManifest

<application
    android:theme="@style/Theme.MyApp.Splash"
    ... >
    <activity
        android:name=".MainActivity"
        android:exported="true"
        android:theme="@style/Theme.MyApp.Splash">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

4. Install the SplashScreen in your MainActivity

class MainActivity : ComponentActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        // Enable the SplashScreen API
        val splash = installSplashScreen()

        // Only if you need to wait for initial data:
        splash.setKeepOnScreenCondition { !uiState.isReady }

        super.onCreate(savedInstanceState)
        setContent {
            AppTheme {
                AppNavHost()
            }
        }
    }
}

๐Ÿ”— Official Splash Screen Guide โ€“ Android Developers

Call today

+34 634 548 126

You've found the person you were looking for. Let's talk.

Let's get you started