How to set shape's opacity?

前端 未结 3 572

I already know how to set the opacity of the background image but I need to set the opacity of my shape object.

In my Android app, I have it like this:

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-04 08:57

    In general you just have to define a slightly transparent color when creating the shape.

    You can achieve that by setting the colors alpha channel.

    #FF000000 will get you a solid black whereas #00000000 will get you a 100% transparent black (well it isn't black anymore obviously).

    The color scheme is like this #AARRGGBB there A stands for alpha channel, R stands for red, G for green and B for blue.

    The same thing applies if you set the color in Java. There it will only look like 0xFF000000.

    UPDATE

    In your case you'd have to add a solid node. Like below.

    
    
        
        
        
        
    
    

    The color here is a half transparent black.

提交回复
热议问题