Reputation: 7128
I am trying to draw text on a live wallpaper that has a background image on it. I was hoping to draw color on the canvas with Transparent so that it didn't cover up the background Image but for some reason it is not drawing the text onto the canvas.
Any ideas on what I am doing wrong?
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);
Upvotes: 2
Views: 5040
Reputation: 132982
update your code:
paintText = new Paint();
paintText.setColor(Color.WHITE);
paintText.setStyle(Style.FILL);
paintText.setAntiAlias(true);
paintText.setTextSize(20);
canvas.save(); //
canvas.drawColor(Color.TRANSPARENT);
canvas.drawText(String.valueOf(Points) + " Points", 50, 50, paintText);
canvas.restore(); //
Upvotes: 1
Reputation: 231
I would say you do not need the
canvas.drawColor(Color.TRANSPARENT);
before drawing the text. Have you tried it without?
Upvotes: 2