Oval

In the same way a rectangle may be drawn using RectF, we can draw an oval. The RectF defines the bounds of the oval. In other words, the oval will be drawn inside the rectangle with the longest point of the oval hitting the midpoint of the top and bottom bounds and the widest point of the oval hitting the midpoint of left and right bounds.

paint.setColor(Color.GREEN);

paint.setStyle(Paint.Style.STROKE);

float leftx = 20;

float rightx = 50;

float bottomy = 100;

RectF ovalBounds = new RectF(leftx,topy,rightx,bottomy); canvas.drawOval(ovalBounds, paint);

Was this article helpful?

0 0

Post a comment