[Chip] Unable to set chip text color
See original GitHub issueDescription: Full description of issue here I am using chip group and setting a style to customize colors:
<style name="Colors_Widget.MaterialComponents.Chip.Choice" parent="Widget.MaterialComponents.Chip.Choice">
<item name="chipBackgroundColor">@color/button_disposition_bg</item>
<item name="chipStrokeWidth">1dp</item>
<item name="android:textColor">@color/button_disposition_text</item>
<item name="shapeAppearance">@drawable/button_disposition_shape</item>
</style>
I faced with the problem - when my Chip is selected, background color is set properly, but I do not see the text. My text color selector:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/colorPrimary" android:state_enabled="true" />
<item android:color="@color/colorMain" android:state_selected="false"/>
<item android:color="@color/colorPrimary" android:state_checked="true" />
<item android:color="@color/colorMain" android:state_checked="false"/>
<item android:color="@color/colorPrimary" android:state_selected="true" />
</selector>
My background selector
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/colorMain" android:state_selected="true" />
<item android:color="@color/colorPrimary" android:state_enabled="true" />
</selector>
Expected behavior: Screenshots and/or description of expected behavior When Chip is checked, the textColor = “@color/colorPrimary” , chipBackground = “@color/colorMain” <item android:color="@color/colorMain" android:state_selected="true" />…
But the chip is completely painted over with the background color so I do not see the text on it. Chip text color and background color are the same = “@color/colorMain” Source code: The code snippet which is causing this issue. Please consider attaching a minimal sample app that reproduces the issue.
Android API version: Android API version here 29 Material Library version: Material Android Library version you are using here (e.g., 1.1.0-alpha07) 1.3.0-alpha01 Device: Device on which the bug was encountered here All devices To help us triage faster, please check to make sure you are using the latest version of the library.
We also happily accept pull requests.
Thank you in advance
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
I have tried this way. It does not work for me. Chip becoming fully painted and text disappearing…For one moment I see the proper color, but text id disappearing fast…
I’ll close the issue due to no further info available. Feel free to reopen it if it’s still reproducible.