Android Canvas.drawText

Posted by Gaz on Stack Overflow See other posts from Stack Overflow or by Gaz
Published on 2010-04-16T18:49:25Z Indexed on 2010/04/16 18:53 UTC
Read the original article Hit count: 472

Filed under:
|
|

Hi All,

I have a view, I'm drawing with the Canvas object in the onDraw(Canvas canvas) method. My code is:

Paint paint = new Paint();
paint.setColor(Color.WHITE);
paint.setStyle(Style.FILL);
canvas.drawPaint(paint);

paint.setColor(android.R.color.black);
paint.setTextSize(20);
canvas.drawText("Some Text", 10, 25, paint);

The problem is the text doesn't show through the background, what am I doing wrong? If I remove the canvas.drawPaint(paint) and paint.setColor(android.R.color.black) you can see the text on the screen.....

© Stack Overflow or respective owner

Related posts about android

Related posts about canvas