Introduction to the drawArc method in the Canvas of Android
Public void drawArc (RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint)
- Oval: Specifies the rectangular area of the outer contour of the arc.
- StartAngle: the starting angle of the arc, measured in degrees.
- SweepAngle: the angle from which the arc is scanned. It is clockwise and measured in degrees. It starts from the middle of the right and ranges from 0 to 0.
- UseCenter: if it is True, the center of the circle is included when the arc is drawn, which is usually used to draw slices. The key is this variable, which will be described in detail below.
- Paint: Specifies the drawing board attribute of an arc, such as color or fill.
Paint paint = new Paint ();
Paint. setStrokeWidth (20 );
Paint. setStyle (Paint. Style. STROKE );
Paint. setColor (Color. BLUE );
Float startAngle01 = 3;
Float sweepAngle01 = 86;
RectF rect = new RectF (center-radius, center-radius, center
+ Radius, center + radius );
Canvas. drawArc (rect, startAngle01, sweepAngle01, true, paint );
When the 4th parameters are true, the plot is as follows:
When it is false, when the following parameter is true, two borders will be drawn from the starting point of the arc to the end point.