Setting color of a Paint object in custom view

前端 未结 2 1733
清酒与你
清酒与你 2020-12-06 07:04

I am trying to make a custom view and have declared the styled attributes like the below:-

  
 

        
2条回答
  •  北海茫月
    2020-12-06 07:58

    If I understand correctly, the constant 0x000000 results in transparent black since there is no Alpha component specified. The Alpha value is the first byte of a four byte color value. The constant for opaque (solid) black is 0xff000000. In other words, the color 0x000000, which is the same as 0x00000000, results in you drawing completely transparently. The constant for Red also looks wrong, resulting in transparent green.

提交回复
热议问题