Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change Chip Background and Stroke color in android with opacity

I want to change com.google.android.material.chip.Chip background with alpha but when I set

app:chipBackgroundColor="#6F000000"

that not work and always have a white background. How can I do this?

like image 718
m.sajjad.s Avatar asked Jan 05 '20 09:01

m.sajjad.s


People also ask

How do I change the color of the selected chip in Android?

So you can use the setChipBackgroundColor(ColorStateList cl) method to set the color of your chip and then you can add an setOnClickListener(new ...) to toggle with selection and non-selection like the following code: yourchip. setOnClickListener(new View.

What is transparent color in Android?

TRANSPARENT (which represents the same thing as @android:color/transparent ) is equal to 0 . The hex representation of 0 is #00000000 , which means that Color. TRANSPARENT is essentially a completely transparent Color.


1 Answers

I find the solution in this link. chips have a white surface layer underneath their background and you can set the transparent color for that with this :

app:chipSurfaceColor="@android:color/transparent"
like image 138
m.sajjad.s Avatar answered Oct 04 '22 11:10

m.sajjad.s