如何画一个透明的圆?

时间:2022-06-14 21:19:50

I'm trying to draw a transparent circle, but it just doesn't work.

我试着画一个透明的圆,但这行不通。

when I'm drawing a bitmap it works, but a circle doesn't become transparent.

当我绘制位图时,它是可行的,但是圆不会变得透明。

Here's my code in short:

下面是我的代码:

Paint paint = new Paint();
paint.setAlpha(125);
canvas.drawBitmap(bitmap, sourceRect, destRect, paint);  // this works fine

canvas.drawCircle(x, y, radius, paint);   // the circle is drawn but not transparent

1 个解决方案

#1


35  

I found it.

我发现它。

paint.setAlpha must come after paint.setColor

油漆。番红花一定是用颜料画出来的

#1


35  

I found it.

我发现它。

paint.setAlpha must come after paint.setColor

油漆。番红花一定是用颜料画出来的