angle attribute in android gradient

后端 未结 3 724
星月不相逢
星月不相逢 2020-12-07 10:17

I am going through test example. Where for some Image background they are using gradient, the code goes like this



        
3条回答
  •  盖世英雄少女心
    2020-12-07 11:11

    Gradient basically represents the variation in space(in a direction) of any quantity. With color it represents the variation of color intensity in a direction represented by angle. Here are some diagrams to represent this concept:
    enter image description here

    Here the figure shows the color variation in horizontal direction (angle is set 0).
    XML code:

        
        
       
    

    enter image description here

    Here the figure shows the color variation in vertical direction (angle is set 90).
    XML code:

    
    
     
    

    You can also use different color as start, center and end colors. The code you attached contains all these elements.

提交回复
热议问题