2011-10-02 112 views
9

我想繪製一個透明的圓形,但它只是不起作用。如何畫一個透明的圓?

當我繪製一個位圖,它的工作原理,但圓不透明。

這裏是我的代碼簡稱:

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 
+0

嘗試調用'的setColor(0x77ff0000)'(左右)之前'drawCycle'。 – Knickedi

回答

35

我發現了它。

paint.setAlpha必須跟從paint.setColor

+2

將它標記爲答案,如果它有幫助 – KadekM

+2

這個類的轉儲行爲是什麼> :( – martyglaubitz

+0

偉大的工作! –