开发者

How to draw a circle with a transparent middle

开发者 https://www.devze.com 2023-01-12 03:07 出处:网络
I am trying to draw a white circle with the following code: mPaint.setColor(0xFFFFFFFF); canvas.drawCircle(x, y, radius, mPaint);

I am trying to draw a white circle with the following code:

mPaint.setColor(0xFFFFFFFF);
canvas.drawCircle(x, y, radius, mPaint);

But it is being displayed as a solid disk. How do I get it to j开发者_运维知识库ust display as a circular outline with a transparent centre?

I've had a look in the help and it makes no sense to me, probably because I'm not used to the drawing terms like stroke and dither. What's wrong with background and border, eh?


I suspect you want:

mPaint.setStyle(Paint.Style.STROKE);

so that it doesn't do the filling. But then again, I've never used the Android API - this is really just a guess based on the docs :)

0

精彩评论

暂无评论...
验证码 换一张
取 消