Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others


0 votes
in Technique[技术] by (71.8m points)

java - How to draw part of ring (arc) using canvas in android?

I am trying to find a way to make arc of the ring. There are the same question, but it was about full ring:

How to draw a ring using canvas in android?

But what do you think how can we make it more abstract?

Now I have something for r1 as outside radius and r2 as inside radius; x and y as the center of the arc; start and end angles as is.

int r1=100;
int r2=80;
int x=200;
int y=200;
int start=0;
int end=90;
canvas.drawArc(new RectF(x-r1, y-r1, x+r1, y+r1), start, end, true, paint);

It makes figure with extra lines from the center, and I don't know how to remove it. I provided the result with indifferent background just to make you see the bounds of canvas and transparency inside the figure.

enter image description here

Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share