Possible to set transparency to XML gradient file?
Is it possible to set transparency in grad开发者_运维问答ient which is set in the XML file?
Say you have a gradient with 2 colors:
StartColor
#111111EndColor
#333333
Adding transparency is as simple as adding 2 HEX digits to the beginning of each color
SO:
If you want the StartColor
(for example) to be 100% opaque:
- change its value to #FF111111
If you want the EndColor
(for example) to be 100% transparent:
- change its value to #00333333
You can of course use values between 00 and FF for transparency if you don't want the extreme values.
The values between HEX 00 and FF are values between 0 and 255 in normal numbers:
To transform from [0,255] to [00,FF]:
- Open calculator in windows and change mode to scientific
There are options like : Dec, Hex, Oct ...
Choose Dec and type the number between 0 and 255
- Choose Hex and the number will become in hex between 00 and FF
You should be able to use #AARRGGBB
format for the start/end colors, with the AA
portion specifying the alpha channel (i.e., transparency).
精彩评论