Reputation: 534
I had a very simple splash using API the background was correctly set. I then started working on themes and fixing bugs, and when I was done, the app icon still show a rounded square with correct background, but the splash is either white or black, it is also reacting to night mode, while it was supposed to retain its brand color at all times.
This is my theme.mxl
file where I define two themes and the splash
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base Chalkboard Theme. -->
<style name="Theme.Base.Chalkboard" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:background">@color/chalkboard_backgroundColor</item>
<item name="android:textColor">@color/chalkboard_textColor</item>
<item name="android:tint">@color/chalkboard_tintColor</item>
<item name="android:fontFamily">@font/open_sans</item>
<item name="colorAccent1">@color/chalkboard_colorAcent1</item>
<item name="colorAccent2">@color/chalkboard_colorAcent2</item>
</style>
<!-- Base Corporate Theme. -->
<style name="Theme.Base.Corporate" parent="Theme.Material3.DayNight.NoActionBar">
<item name="android:background">@color/corporate_backgroundColor</item>
<item name="android:textColor">@color/corporate_textColor</item>
<item name="android:tint">@color/corporate_tintColor</item>
<item name="android:fontFamily">@font/open_sans</item>
<item name="android:textColorPrimaryDisableOnly">@color/corporate_textColor</item>
<item name="android:textColorAlertDialogListItem">@color/corporate_textColor</item>
<item name="colorAccent1">@color/corporate_colorAcent1</item>
<item name="colorAccent2">@color/corporate_colorAcent2</item>
</style>
<!-- Base splash theme -->
<style name="Theme.Splash" parent="Theme.Material3.DayNight.NoActionBar">
<item name="windowSplashScreenBackground">@color/royal_blue</item>
<item name="windowSplashScreenAnimatedIcon">@mipmap/ic_launcher</item>
<item name="windowSplashScreenAnimationDuration">200</item>
<item name="postSplashScreenTheme">@style/Theme.Base.Chalkboard</item>
</style>
</resources>
This is how I invoke the splash screen inside my MainActivity
this part was not changed:
@Override
protected void onCreate(Bundle savedInstanceState) {
// Handle the splash screen transition.
long delay = 578L;
SplashScreen splashScreen = SplashScreen.installSplashScreen(this);
splashScreen.setKeepOnScreenCondition(() -> keepSplashOnScreen);
new Handler(Looper.getMainLooper()).postDelayed(() -> keepSplashOnScreen = false, delay);
My application theme is Theme.Splash
while each activity use the Theme.Base.Chalkboard
thne theme is then replaced with Theme.Base.Corporate
if the user has selected this theme in the settings.
I tried recreating the mipmap
icon, used both SVG
and PNG
as sources to try something out, I have disabled legacy icons since I target Android 10Q and above devices. I'm running short of ideas about what to test. Commenting out my themes didn't solve the problem. In particular I was worried about the android:background
setting.
edit: The background of the splash is #fef7ff
so not exactly white.
Upvotes: 0
Views: 94
Reputation: 76809
Theme.Splash
has the wrong parent theme. This should rather be:
<style name="Theme.Base.SplashScreen" parent="Theme.SplashScreen" tools:targetApi="s">
...
</style>
Upvotes: 0