Material-components-android: How to set chip text selected/unselected color?

Created on 10 Jul 2018  路  2Comments  路  Source: material-components/material-components-android

How to set chip text selected/unselected color?

android:textColor doesn't work for me.

Most helpful comment

<android.support.design.chip.Chip
    android:id="@+id/test"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:checkable="true"
    android:clickable="true"
    android:focusable="true"
    app:chipBackgroundColor="@color/bg_chip_state_list"
    app:chipText="Test" /> 


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="@color/colorSecondaryLight" android:state_checked="true" />
    <item android:color="@color/colorPrimaryDark" />
</selector>

All 2 comments

are you using a ColorStateList with a different selected color? https://developer.android.com/guide/topics/resources/color-list-resource

For usage questions can you ask on stackoverflow with the material-components-android tag?

<android.support.design.chip.Chip
    android:id="@+id/test"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:checkable="true"
    android:clickable="true"
    android:focusable="true"
    app:chipBackgroundColor="@color/bg_chip_state_list"
    app:chipText="Test" /> 


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="@color/colorSecondaryLight" android:state_checked="true" />
    <item android:color="@color/colorPrimaryDark" />
</selector>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

JakeWharton picture JakeWharton  路  3Comments

sepehr-alipour picture sepehr-alipour  路  3Comments

zkovar picture zkovar  路  3Comments

KelvinPac picture KelvinPac  路  3Comments

gabrielemariotti picture gabrielemariotti  路  3Comments