如何用透明的中间画一个圆 [英] How to draw a circle with a transparent middle

查看:138
本文介绍了如何用透明的中间画一个圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用以下代码绘制白色圆圈:

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 just 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?

推荐答案

我怀疑您想要这样做:

mPaint.setStyle(Paint.Style.STROKE);

以免填充.但是话又说回来,我从未使用过Android API-这实际上只是基于文档的猜测:)

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 :)

这篇关于如何用透明的中间画一个圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆