Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Stroke looks pixelated at the corners of a rounded rectangle

Tags:

android

stroke

Why is the stroke at the corners of the rectangle so ugly? If I draw the shape in xml, it works fine (at least it works in activities, I could not test 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 on hdpi density. Has anyone met this problem?

like image 749
erdomester Avatar asked Dec 20 '22 21:12

erdomester


1 Answers

Try with:

strokePaint.setAntiAlias(true)
like image 180
Pablo Avatar answered Jan 15 '23 11:01

Pablo