Shader的使用

一、LinearGradient

步骤:①、创建LinearGradient  步骤   ②、将其加入到Paint

步骤一:

构造LinearGradient的参数

public LinearGradient (float x0, float y0, float x1, float y1, int[] colors, float[] positions, Shader.TileMode tile);

x0,y0代表渐变的起始位置,x1,y1代表终止位置。

两边位置决定是纵向渐变还是横向,或者倾斜。

例:x0 = 0, y0= 0,x1=0,y1 = height  为垂直渐变。(其他的就不举例了)

http://www.tuicool.com/articles/RF7v2qY

原文地址:https://www.cnblogs.com/rookiechen/p/5504447.html