Search code examples
androidandroid-splashscreen

Icon background color in Android 12 Splash Screen does not work


In my Android project I use Splash Screen API to add splash screen to my app. My theme that I apply to application in Manifest looks like this:

<style name="Launcher" parent="Theme.SplashScreen">
    <item name="windowSplashScreenBackground">@color/background</item>
    <item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
    <item name="windowSplashScreenIconBackgroundColor">@color/orange</item>
    <item name="postSplashScreenTheme">@style/AppTheme</item>
</style>

@color/orange in windowSplashScreenIconBackgroundColor should add circle shaped backround around icon. However, background is not added, there is just an icon and a background.

I add corresponding theme to my app as following:

<application
    android:name=".App"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name_label"
    android:theme="@style/Launcher">

I tried to change splash screen windowSplashScreenBackground to orange and it worked, so the problem is not that my theme is ignore somehow.


Solution

  • If you want to override windowSplashScreenIconBackgroundColor, you have to extend Theme.SplashScreen.IconBackground theme, not the Theme.SplashScreen. Something like this:

    <style name="Launcher" parent="Theme.SplashScreen.IconBackground">
        <item name="windowSplashScreenBackground">@color/background</item>
        <item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
        <item name="windowSplashScreenIconBackgroundColor">@color/orange</item>
        <item name="postSplashScreenTheme">@style/AppTheme</item>
    </style>