I have a problem that when I draw an arc the shadow layer is not being drawn. Here’s my Paint object:
circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
circlePaint.setStrokeWidth(strokeWidth);
circlePaint.setColor(Color.WHITE);
circlePaint.setStyle(Paint.Style.STROKE);
circlePaint.setShadowLayer(shadowRadius, 0, shadowOffset, 0xFF000000);
and in onDraw():
canvas.drawArc(rect, 0, 180, false, circlePaint);
I have a feeling the shadowLayer is just being ignored. Is there any other way to draw a drop shadow around an oval? The problem is, that the oval get’s resized (as in the height gets bigger), so I can’t just use a ninepatch.
Paint.setShadowLayerworks only with text if hardware acceleration is enabled. To work around it you can just disable hardware acceleration for this particular view.