Android - Stroke looks jagged in corners of a rounded rectangle

Why is the stroke at the corners of the rectangle so ugly? If I draw a form in xml, it works fine (at least it works in actions, I cannot validate it with a widget).

Paint strokePaint = new Paint();
strokePaint.setARGB(255, 16, 23, 131);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(8);

enter image description here

I am testing hdpi density. Has anyone encountered this problem?

+3
source share
1 answer

Try:

strokePaint.setAntiAlias(true)
+10
source

All Articles