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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With