I have an issue that I saw several times on SO but I was unable to resolved it with the proposed solutions. I want to put a colored stroke around my text in a text view, which uses a custom font, and then fill it with a second color. When the text is set in the xml (with the strings) it works just fine. But if i use .setText(); it doesn't work anymore. I have only the stroke with no filled color OR the stroke and the fill color but both with the same color.
Here is the code for the onDraw TextView that handle it :
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
TextPaint paint = this.getPaint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeJoin(Paint.Join.BEVEL);
paint.setColor(mStrokeColor);
paint.setStrokeWidth(mStrokeWidth);
super.onDraw(canvas);
paint.setStyle(Paint.Style.FILL);
this.setTextColor(mFillColor);
}
Any help would be very welcome.