How can I use dynamic colors in SplashScreen api an android 12?
Asked Answered
J

2

6

I'm trying to make the background of an android 12 splash screen use @android:color/system_neutral1_900 as the background, but as I can see, the color loads only after the splash screen. Is there any way to use it on the splash screen?

<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen">
    <!-- Set the splash screen background, animated icon, and animation duration. -->
    <item name="windowSplashScreenBackground">@android:color/system_neutral1_900</item>
</style>

The color does not appear and it uses the default grey. I also tried with other system_ colors and the same result comes up. Using @android:color/black or hex colors works.

Jaclin answered 23/7, 2022 at 18:15 Comment(1)
So far it seems to me that this is not possible. If you have a closer look at the official Phone and Messages apps by Google, even their splash screens don't have Monet theming. :(Elamite
S
0

Try using this item as part of your main application theme according to this link

 <!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowSplashScreenBackground">@color/colorAccent</item>
</style>
Souse answered 23/7, 2022 at 20:44 Comment(1)
Hi. My problem wasn't that I cannot theme the splash screen, it was that I can not use the system dynamic colors (monet colors) for theming it. If I set windowSplashScreenBackground to a color like @android:color/black it works. I just want to use dynamic colors, as my app uses it and I don't like the transition from that simple white to the one with a tint. Thank you though for trying to help me.Jaclin
E
0

Just delete the splash screen background color item.

Excessive answered 18/12, 2023 at 16:18 Comment(2)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Potty
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewAdult

© 2022 - 2024 — McMap. All rights reserved.