0

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?

halfer
  • 19,824
  • 17
  • 99
  • 186
Mark Delphi
  • 1,376
  • 1
  • 11
  • 29

2 Answers2

1

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

Primož Ivančič
  • 1,984
  • 1
  • 17
  • 29
  • Thank you so much for your response. I found the possible way programmatically: https://stackoverflow.com/questions/17237614/programmatically-make-a-color-more-transparent – Mark Delphi Apr 07 '22 at 10:33
1
android:alpha="0.5"

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

halfer
  • 19,824
  • 17
  • 99
  • 186