I am trying to add a stroke to a custom shape I have added.
Here is the code
private void drawBackground(Canvas canvas) {
float height = getHeight();
float width = getWidth();
canvas.drawRoundRect(0, 0, width, height, 5, 5, canvasPaint);
canvas.drawRoundRect(0, 0, getTextWidth(), getHeight(), 5, 5, canvasStrokePaint);//to draw black stroke
canvas.drawText(name, width / 2 - getTextWidth() / 2, getBitmapHeight() + 20, textPaint);
Path path = new Path();
path.moveTo((width / 3), height);
path.lineTo((width / 2), (height + height / 3));
path.lineTo((width - width / 3), height);
path.lineTo((width / 3), height);
path.close();
canvas.drawPath(path, canvasPaint);
canvas.drawPath(path, canvasStrokePaint);//to draw black stroke
}
The output
Here you can see there is a closed edge for rectangle and triangle.
But the stroke should be outside of the shape.
Requirement
Thanks in advance


You can try to draw this particular shape in black, and then you can write on the top of it another shape (a bit smaller) in green color. The result should be as you would expected.