This must be an easy one but I\'m really at a loss... The following code draws a rectangle with a linear gradient going from left to right, from white to black,
<
I haven't done much android coding, but one approach worth trying is:
int x1 = 0, y1 = 0, x2 = 0, y2 = 40;
The x never changes in the gradient only the y does.
So what this might look like is:
Shader shader = new LinearGradient(0, 0, 0, 40, Color.WHITE, Color.BLACK, TileMode.CLAMP);
Paint paint = new Paint();
paint.setShader(shader);
canvas.drawRect(new RectF(0, 0, 100, 40), paint);