我在不同的位置画了多条线。
例如:
canvas.drawLine(startXLine1 ,stopXLine1, startYLine1, stopYLine1, paint)
canvas.drawLine(startXLine2 ,stopXLine2, startYLine2, stopYLine2, paint)
I want a gradient like this for each line:
当我尝试这个时,我没有这种效果,但是这个方向的渐变蓝色(左)--->白色(右)
像这样:http://media.24ways.org/2011/verou/1.png http://media.24ways.org/2011/verou/1.png
Shader shader = new LinearGradient(startXLine1, startYLine1, stopXLine1, stopYLine1, res.getColor(R.color.blue), res.getColor(R.color.white), Shader.TileMode.CLAMP);
paint.setShader(shader);
有人可以帮我解决这个问题吗?
要像图片一样填充背景:
Shader shader = new LinearGradient(0, 0, 0, h /*canvas height*/, res.getColor(R.color.blue), res.getColor(R.color.white), Shader.TileMode.MIRROR /*or REPEAT*/);
paint.setShader(shader);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)