I have a ChipGroup
that has one Chip
item :
<com.google.android.material.chip.ChipGroup
android:id="@+id/chip_group"
android:layout_width="0dp"
android:theme="@style/DarkThemeTag"
android:layout_height="wrap_content">
<com.google.android.material.chip.Chip
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/tag_text_dimen"
app:chipIcon="@null"
app:chipIconEnabled="false"/>
As you can notice I set the DarkThemeTag
theme on the ChipGroup
.
<style name="DarkThemeTag" parent="Theme.MaterialComponents.Light.Bridge">
<item name="chipBackgroundColor">@color/tag_chip_dark_checkable</item>
<item name="android:textColor">@android:color/white</item>
</style>
My app theme inherits from AppCompat
, not from MaterialComponents
:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
....
</style>
According to Chip official page it inherits from MaterialComponents
.
@Mikail Sharin says that app's theme should inherit from MaterialComponents
.
In this article is stated that if you can't change your app to inherit from MaterialComponents
and you want to stick to AppCompat
you should use one of the Bridge Themes, so that's what I did.
The problem is that the chipBackgroundColor
attribute does not apply to ChipGroup's children. The android:textColor
does however.
Do you guys have any ideea what can be wrong?
Note:If I apply the same style on the Chip
element it works