如何画一个透明的圆圈?

pio*_*ojo 9 android android-canvas

我想画一个透明的圆圈,但它不起作用.

当我绘制位图时,它可以工作,但圆圈不会变得透明.

这是我的简短代码:

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
Run Code Online (Sandbox Code Playgroud)

pio*_*ojo 35

我找到了.

paint.setAlpha 必须来 paint.setColor

  • 什么是这个类的转储行为> :( (2认同)