Hello, I have a line drawn vertically, let's say it has 100 pixels. I want to make this line half lenght white, half lenght red. Can I achieve this with a gradient ?
I tried stuff like
linePaint.setShader(
new LinearGradient(x,y, x1, y2,
new int[] { Color.WHITE, Color.RED},
null,
Shader.TileMode.MIRROR));
canvas.drawLine(x,y,x1,y1,linePaint);
In .NET is very simple to do this with a gradient but in Android I'm stuck. Any help is really appreciated. Thank you.