Introduction to the drawArc method in the Canvas of Android

Source: Internet
Author: User
Tags in degrees

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.