MaterialToolbar on Material3 DayNight still using Material2 default coloring
See original GitHub issueDescription:
Using Theme.Material3.DayNight
as base theme. Styling the MaterialToolbar
like title and action menu icon color still uses the Material2 default value like android:textColorPrimary
for the title and colorControlNormal
for navigation/action menu icon.
Expected behavior:
colorOnSurface
for title color and colorOnSurfaceVariant
for icons should work based on the documentation.
However background color works perfectly fine, even I define colorPrimary
it won’t work until I set colorOnSurface
.
Source code:
<!-- Base application theme -->
<style name="Theme.Cryptonian" parent="Theme.Material3.DayNight">
<!-- Toolbar navigation icon tint -->
<item name="android:textColorPrimary">@android:color/holo_red_dark</item>
<item name="colorControlNormal">@android:color/holo_red_dark</item>
</style>
<!-- Base application theme -->
<style name="Theme.Cryptonian" parent="Theme.Material3.DayNight">
<!-- Toolbar navigation icon tint -->
<item name="colorOnSurface">@android:color/holo_green_dark</item>
<item name="colorOnSurfaceVariant">@android:color/holo_green_dark</item>
</style>
Minimal sample app repro: N/A
Android API version: SDK 21
Material Library version: 1.6.0-beta01
Device: Samsung J1
Issue Analytics
- State:
- Created a year ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Material Design 3: How to make Toolbars the same color as ...
According with documentation, the default value for a Toolbar background is ?attr/colorSurface and it is set on android:background .
Read more >Migrating to Material Components for Android
Knowing which widgets use which colors requires inspecting the default widget styles in the source code. There are also colors from AppCompat ......
Read more >[Top app bars] Theming the top app bar and Contextual action ...
after I created a new project with a Material 3 theme and I tried to ... The toolbar is transparent by default so...
Read more >MaterialToolbar - Android Developers
MaterialToolbar is a Toolbar that implements certain Material features, such as elevation overlays for Dark Themes and centered titles.
Read more >Styling Theme (with Dark Mode) and ... - ProAndroidDev
This is the Part 2 of the Series on Material Theme. To know how to add material components to your app, Part 1...
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
Re: a sample, if I add the following to our Catalog demo app theme, then the surface colors get applied as expected to the
toolbarSurfaceStyle
MaterialToolbar
s:This one: https://github.com/material-components/material-components-android/tree/master/catalog/java/io/material/catalog/topappbar