'Android <= 11 Splash Screen Background Color and Branding

With the new android 12 splash screen migration the following is required.

<style name="Theme.App.Starting" parent="Theme.SplashScreen">
    <item name="windowSplashScreenBackground">@color/bootsplash_background</item>
    <item name="windowSplashScreenAnimatedIcon">@mipmap/bootsplash_logo</item>
    <item name="android:windowSplashScreenBrandingImage">@drawable/brand_logo</item> 
    <item name="postSplashScreenTheme">@style/AppTheme</item>
</style>

The issue is windowSplashScreenBackground and windowSplashScreenBrandingImage is not used by Android <= 11. So how do we get the background to be a specific color and also show the branding at the bottom?



Solution 1:[1]

The official document had reminded the developers to use the Androidx SplashScreen compat library to do the splash screen in the Android <= 11.

But it also has some limitations:

  1. icon animation is not supported -- AnimatedVectorDrawable
  2. icon background is not supported -- IconBackgroundColor
  3. brand logo is not supported -- BrandingImage

The link about the SplashScreen compat library:https://developer.android.google.cn/reference/kotlin/androidx/core/splashscreen/SplashScreen

You can set the windowSplashScreenBackground in the Android <= 11 by the following code with the Androidx SplashScreen compat library.

<item name="windowSplashScreenBackground">@android:color/white</item>

In addition, the official document also sayed : Optionally, you can use windowSplashScreenBrandingImage to set an image to be shown at the bottom of the splash screen. The design guidelines recommend against using a branding image.

If you need more information, please check the official document:https://developer.android.google.cn/guide/topics/ui/splash-screen/migrate and https://developer.android.com/guide/topics/ui/splash-screen

Furthermore, you need to set the theme in the <application> and <Mainacticvity>. Such as:

<application android:theme="@style/AppTheme"></application>
[Activity(Label = "@string/app_name", Theme = "@style/Theme.App.Starting", MainLauncher = true)]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1