Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paint bordered text in a Canvas android

I'd like to paint in a Canvas something like:

enter image description here

How can I do the bordered effect? Thanks

like image 330
Addev Avatar asked Feb 03 '12 17:02

Addev


1 Answers

Draw the text two times. First draw the text with a fill paint like so:

Paint fillPaint = new Paint(); fillPaint.setColor(Color.MAGENTA); canvas.drawText(.... fillPaint); 

Then draw it again with a stroke like so:

Paint stkPaint = new Paint(); stkPaint.setStyle(Style.STROKE); stkPaint.setStrokeWidth(8); stkPaint.setColor(Color.WHITE); canvas.drawText(.... stkPaint); 
like image 182
Samuel Avatar answered Sep 18 '22 23:09

Samuel