Paint bordered text in a Canvas android

后端 未结 1 1428
星月不相逢
星月不相逢 2021-02-03 23:18

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

\"enter

How can I do the bordered e

相关标签:
1条回答
  • 2021-02-04 00:05

    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);
    
    0 讨论(0)
提交回复
热议问题