[Theme.Material3.Light] 'DynamicColors.applyToActivitiesIfAvailable()' affect on 'forcedarkAllowed = true' behavior
See original GitHub issueHi,
Description: The App use Theme.Material3.Light.NoActionBar
theme with android:forceDarkAllowed = true
attribute.
Also applied ‘Dynamic Colors’ feature through DynamicColors.applyToActivitiesIfAvailable()
. In-App colors don’t tailor to the enabled Dark Theme (exclude dialogs). With disabled ‘Dynamic Colors’ feature, all work fine.
It is expected behavior?
Expected behavior: Colors must be changed according to the forceDarkAllowed = true
attribute.
Source code:
<style name="MainTheme" parent="Theme.Material3.Light.NoActionBar">
...
<item name="android:windowBackground">@android:color/white</item> -- stayed as is.
<item name="android:forceDarkAllowed">true</item>
...
</style>
Android API version: 31
Material Library version: 1.5.0-rc01 or 1.6.0-alpha01
Device: Pixel 4a
Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[Theme.Material3.Light] 'DynamicColors ... - IssueHint
applyToActivitiesIfAvailable ()' affect on 'forcedarkAllowed = true' behavior. ... Light.NoActionBar theme with android:forceDarkAllowed = true attribute.
Read more >MDC-Android – Material Design 3
Apply dynamic color using Material Design 3 for AndroidCodelab with step-by-step instructions for adding dynamic color features to an app. Material Design ...
Read more >Dark theme - Android Developers
Makes it easier for anyone to use a device in a low-light environment. Dark theme applies to both the Android system UI and...
Read more >An Android Material Design 3 Theming and Dynamic Color ...
Review the color scheme in the Your Theme panel and make any ... to the applyToActivitiesIfAvailable() method of the DynamicColors class.
Read more >Implementing Dark theme in your Android Application
And if you haven't already updated your app to support Dark theme, your app ... Light"> <item name="android:forceDarkAllowed">true</item>
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dsn5ft I see my misstep. I have used
DynamicColors.applyToActivitiesIfAvailable()
and solution above simultaneously. Thanks again!Hmm the Activity background seems to be automatically switching to dark as expected for me, so not sure what the difference with your app is: