I want to display text as below in my app. I am using Paint
class with style FILL_AND_STROKE
to achieve this. But only one method setColor()
is available to set the color.
How do I set different stroke and fill colors?
Inside custom TextView (does not work in EditText):
@Override
public void onDraw(Canvas canvas)
{
final ColorStateList textColor = getTextColors();
TextPaint paint = this.getPaint();
paint.setStyle(Style.STROKE);
paint.setStrokeJoin(Join.ROUND);
paint.setStrokeMiter(10);
this.setTextColor(strokeColor);
paint.setStrokeWidth(strokeWidth);
super.onDraw(canvas);
paint.setStyle(Style.FILL);
setTextColor(textColor);
super.onDraw(canvas);
}