ccd
ccd

Reputation: 6918

How to create splash screen theme on compose theme.kt file

I want to moving all theme related xml code to compose file. There is a splash screen xml code, is it possible to let it in compose style?

<!-- Splash screen theme. -->
<style name="splashScreenTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowBackground">@drawable/splash_screen</item>
</style>

@Composable
fun splashScreenTheme() {

}

Upvotes: 11

Views: 2012

Answers (1)

machfour
machfour

Reputation: 2710

As of Compose 1.0.1 / August 2021, there is no way to do this completely in Compose. I am currently using the XML/android:windowBackground based solution in the OP for my app which is pretty much entirely Compose otherwise.

However, note that Android 12 is introducing a SplashScreen API which lets you define a splash screen consisting of an adaptive icon and solid background colour.

Also, remember that things like date/time pickers are still not yet available natively in Compose, so if you use the Material Components library for that, you will still need the XML style files.

Upvotes: 2

Related Questions