0

I am trying to change the opacity of color to 20% transparent but when I add this hex code '33' in this color hex code '#FF2F2F2F' my code editor gives me error.

The color in res/values/colors.xml file

<color name="windowDark">#33FF2F2F2F</ color>
Jamal
  • 111
  • 8

2 Answers2

3

you can not make a Opaque which is already a Opaque . Its ARGB that's 8 bit for each .

enter image description here

If your color hex is #2F2F2F then you add Alpha in front of it i.e #332F2F2F .if you want to change the alpha then just change the Starting two.

FF in your example color code is value of Alpha. You do not need FF in your color anyway that's goes for 100% Alpha. Anyway when u wanna change the alpha you just replace FF with 33. See This thread for opacity .

ADM
  • 20,406
  • 11
  • 52
  • 83
1

Easy set opacity with percentage check this

red color color code is = "#eb4336"
now set opacity before color code like this

#10eb4336 (first 10 is opacity 10%) you use easy like 

10% = #10eb4336
20% = #20eb4336
30% = #30eb4336
milan pithadia
  • 840
  • 11
  • 16