Android Chip_How to make chip background color transparent programmatically?

270 Views Asked by At

I want to make the android chip background color to transparent.

From material version higher than 1.1.0,
we need to set app:chipBackgroundColor="@color/transparent" but also app:chipSurfaceColor="@color/transparent"

Ok, I see. But how can it do by kotlin code?

background color can be set by code below...

chipBackgroundColor = ColorStateList.valueOf(ContextCompat.getColor(context, android.R.color.transparent))

But, I can't find the code that changes its surface color!!

Is there any solution?

1

There are 1 best solutions below

2
On

chip.chipBackgroundColor = getColorStateList(your color)