Search code examples
androidandroid-jetpack-composeandroid-splashscreen

custom image for splash screen in compose


I am using the splash screen and want to have an image instead of a background color.

This is a compose project.

androidx.core:core-splashscreen:1.0.1

I am using the following

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.App.Starting" parent="Theme.SplashScreen">
        <item name="windowSplashScreenBackground">@drawable/splash</item>
        <item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
        <item name="postSplashScreenTheme">@style/Theme.BusbyNimbleSurvey</item>
    </style>
</resources>

the splash is a png image and I have also tried with a webp. However, when testing it just a black background.

Is this possible?


Solution

  • I have tried several ways while finding to set drawable as a Splash Screen Background but failed. While digging into SDK code, I found this in values.xml that only color values can be set as background in Splash Screen API. Attached screenshot is for the reference.

    enter image description here