material-components / material-components-android

Modular and customizable Material Design UI components for Android
Apache License 2.0
16.42k stars 3.08k forks source link

[Chip] Close icon on chip doesn't tint properly #1825

Closed kightsonsanom closed 4 years ago

kightsonsanom commented 4 years ago

Description: The issue is really similar to #767 issue . The difference is that this issue refers to the the closeIcon.

Expected behavior:

image

Current behavior: This is how the drawable looks like without specifying closeIconTint attribute:

image

This is how the drawable looks like with closeIconTint attribute specified

image

Source code: ic_icon_close_hashtag_active.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="42dp"
    android:height="42dp"
    android:viewportWidth="42"
    android:viewportHeight="42">
  <path
      android:pathData="M13.55,13.856L28.5,28.807M13.55,28.545l14.95,-14.95"
      android:strokeWidth="3"
      android:fillColor="#00000000"
      android:strokeColor="#82BEBF"/>
  <path
      android:pathData="M1,1L1,0.25L0.25,0.25L0.25,1L1,1zM41,1h0.75L41.75,0.25L41,0.25L41,1zM41,41v0.75h0.75L41.75,41L41,41zM1,41L0.25,41v0.75L1,41.75L1,41zM1,1.75h40L41,0.25L1,0.25v1.5zM40.25,1v40h1.5L41.75,1h-1.5zM41,40.25L1,40.25v1.5h40v-1.5zM1.75,41L1.75,1L0.25,1v40h1.5z"
      android:fillColor="#EBECF5"/>
</vector>

removable_chip.xml

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.chip.Chip xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tool="http://schemas.android.com/tools"
    style="@style/Widget.MaterialComponents.Chip.Entry"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="@style/TextAppearance.H9"
    android:textColor="@color/colorPrimary"
    app:chipBackgroundColor="@color/white"
    app:chipEndPadding="0dp"
    app:chipMinHeight="40dp"
    app:chipStrokeColor="@color/colorAccentLight"
    app:chipStrokeWidth="3dp"
    app:closeIcon="@drawable/ic_icon_close_hashtag_active"
    app:closeIconEndPadding="0dp"
    app:closeIconSize="40dp"
    app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.StraightCut"
    tool:text="depression" />

Android API version: 29

Material Library version: 1.2.1 and 1.3.0-alpha03

Device: Pixel 2

kightsonsanom commented 4 years ago

Specifying closeIconTint as null solves the problem. The drawable color is taken into account.