我正在試圖在上面有背景圖像的動態壁紙上繪製文本。我希望在透明畫布上繪製顏色,這樣它就不會掩蓋背景圖像,但由於某種原因,它不會將文本繪製到畫布上。Canvas.drawText()不能正常工作
關於我在做什麼的錯誤?
paintText = new Paint();
paintText.setColor(Color.WHITE);
paintText.setStyle(Style.FILL);
paintText.setAntiAlias(true);
paintText.setTextSize(20);
canvas.drawColor(Color.TRANSPARENT);
canvas.drawText(String.valueOf(Points) + " Points", 50, 50, paintText);
嗯,怎麼樣Color.WHITE代替Color.TRANSPARENT? – Coffee 2012-03-14 22:07:43
好吧,我嘗試了Color.WHITE,並將文本顏色更改爲Color.BLACK,但我得到的是一個沒有文本的完整白色屏幕。 – Gatekeeper 2012-03-14 22:10:48
@Gatekeeper把'canvas.restore();'放在'drawText()'後面' – 2012-03-14 22:33:43