0

I have a layout that is covered entirely by a tint overlay (it's the last element in my RelativeLayout).

  1. I have TextView1 and TextView2 with textColor set to red (#FF0000).
  2. My tint overlay is grey with transparency set - #88676767.
  3. I want my TextView1 tinted but TextView2 appear red (#FF0000).

Is there a way for me to calculate color value X for TextView2 so when it is overlayed with a tint layer it appears to the user as red (#FF0000)? If so, how do I go about calculating this value?

0x4B1D
  • 923
  • 1
  • 9
  • 19

1 Answers1

0

No, there is no way to achieve this. The color is calculated as

(color1.R*color1.A + color2.R*color2.A)/(color1.A+color2.A)

This equation does not have solution for color1.R in (0, 255) and color1.A in (0, 1) when color2 is your overlay and result color is 255.

Find more info in this answer.

Community
  • 1
  • 1
Lamorak
  • 10,957
  • 9
  • 43
  • 57