开发者

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 #111111
  • EndColor #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]:

  1. Open calculator in windows and change mode to scientific
  2. There are options like : Dec, Hex, Oct ...

    Choose Dec and type the number between 0 and 255

  3. 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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜