Line

A line is, well, a line: a series of points extending in a single direction from a start point to an end point. You draw a line in using the Canvas method drawLine, passing in a start x and y coordinate, an end x and y coordinate, and a Paint object. Figure 4-5 illustrates how the following code will render.

paint.setColor(Color.GREEN);

paint.setStrokeWidth(l0);

int starty = 100;

canvas.drawLine(startx,starty,endx,endy,paint);

Simple Draw

Was this article helpful?

0 0

Post a comment