Chip materialThemeOverlay is not working
See original GitHub issueDescription: The implementation with Chip in Material 3 is not working after following the documentation
Expected behavior: Should apply the styling based on what was stated in the documentation.
Source code:
Not working, incorrect color.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Chip style on both light and night mode -->
<style name="AppChip" parent="Widget.Material3.Chip.Input">
<item name="closeIconVisible">false</item>
<item name="checkedIconVisible">false</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Chip</item>
<item name="shapeAppearanceOverlay">@style/ShapeAppearance.App.SmallComponent</item>
</style>
<style name="ThemeOverlay.App.Chip" parent="">
<item name="colorOnSurfaceVariant">@color/chip_state_list</item>
<item name="colorOnSurface">@color/background_color_chip_state_list</item>
</style>
</resources>
Working correct color
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Chip style on both light and night mode -->
<style name="AppChip" parent="Widget.Material3.Chip.Input">
<item name="closeIconVisible">false</item>
<item name="checkedIconVisible">false</item>
<item name="android:textColor">@color/chip_state_list</item>
<item name="chipStrokeColor">@android:color/transparent</item>
<item name="chipBackgroundColor">@color/background_color_chip_state_list</item>
<item name="shapeAppearanceOverlay">@style/ShapeAppearance.App.SmallComponent</item>
</style>
<!--TODO theme overlay-->
</resources>
Usage in main theme
<item name="chipStyle">@style/AppChip</item>
Android API version: SDK 21
Material Library version: 1.6.0-beta-01
Device: Samsung J1
Is it just me or the Material 3 components and its documentations are not yet finish or finalize? I keep having this issue where the documentation and the behavior is not correct.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
[Chip] materialThemeOverlay support · Issue #1003 - GitHub
Almost all library components support materialThemeOverlay, and developer can change ... but for some reason this is not implemented for chip.
Read more >MaterialThemeOverlay - Android Developers
Utility to apply a theme overlay to any Context . The theme overlay is read from an attribute in the style. This is...
Read more >Chips - Material Design
Chips are mostly commonly used in groups. We recommend using ChipGroup as it is purpose-built to handle multi-chip layout and behavior patterns (as...
Read more >Material Chip chipStrokeColor is not being applied to Chip ...
I am using Material Chips from the Material Components Library: com.google.android.material:material:1.1.0 I have created styles for Chips ...
Read more >The components of Material Design (Android Dev Summit '18)
Material Theming launched this year at Google I/O, enabling you to systematically customize Material Design to better reflect your product's ...
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
I think it’s using colorOnSecondaryContainer (selected) and colorOnSurfaceVariant (unselected.)
It works! Thanks. How about for its text color?