How to get colors?

54 Views Asked by At

I am trying to achieve something like this

enter image description here

where the text and background colors are similar. How do I get the corresponding background (probably 50% transparent of chosen color) color for a chip in Android?

2

There are 2 best solutions below

1
On BEST ANSWER

Simply take the color you use for the text and set alpha to 0.5f.

0
On
android:alpha="0.5"

This takes float value ranging from 0.0 (transparent) to 1.0 (fully visible).