Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SplashScreen compat library with Jetpack Compose

Is it possible to properly use the SplashScreen compat library (https://developer.android.com/about/versions/12/splash-screen-migration#splashscreen_compat_library) with Jetpack Compose? It is desirable to immediately call setContent in onCreate, like so:

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        installSplashScreen()

        setContent {
            // ...
        }
    }
}

However, setContent replaces the root view when it finishes loading. Therefore, the splash screen exit animation does not finish. The alternative is to call setContent when the exit animation finishes, but this is inefficient. Is there any other alternative?

like image 633
Felix Schütz Avatar asked Oct 26 '25 12:10

Felix Schütz


1 Answers

This problem has been fixed with version 1.0.0-alpha02 of the library. See https://developer.android.com/jetpack/androidx/releases/core#core-splashscreen-1.0.0-alpha02 for details.

like image 73
Felix Schütz Avatar answered Oct 29 '25 05:10

Felix Schütz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!