I draw an arc on the canvas in the user view, as shown below. Paint and rectangle defined outside onDraw() and added there for simplicity.
protected void onDraw(Canvas canvas) { super.onDraw(canvas); RectF rectangle = new RectF(60f, 60f, 480f, 480f); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setColor(0x40000000); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(120); canvas.drawArc(rectangle, 225f, 315f, false, paint); }
When I run this code on Galaxy Nexus with 4.3, the following artifacts appear. 
There are no such artifacts when working on Nexus 5 with 4.4.4. 
I observed artifacts at angles such as (225f, 315f) and only a few other angles. Most of the time, the arc has a regular shape.
Is there any way to avoid these artifacts?
Update: I tried to use software, hardware and not a single level using setLayerType() . Artifacts changed their form, but were still present.
android android-canvas android-custom-view
sergej shafarenka
source share