piojo
piojo

Reputation: 1929

How to draw a transparent circle?

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

Upvotes: 10

Views: 7354

Answers (1)

piojo
piojo

Reputation: 1929

I found it.

paint.setAlpha must come after paint.setColor

Upvotes: 35

Related Questions