I am facing issue with shadow color, setShadowLayer method is ignoring shadowColor (Here i specified Color.RED in my code) instead of setShadowLayer is taking paint color (Here Color.argb(255, 50, 153, 187)). Below is my paint settings and find attached image for reference, thanks
paint.setAntiAlias(true);
paint.setColor(Color.argb(255, 50, 153, 187));
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setStrokeWidth(STROKE_WIDTH);
paint.setStrokeCap(Paint.Cap.ROUND);
paint.setShadowLayer(7.0f, 20.0f, 2.0f, Color.RED);
the shadowLayer works only it the hardware acceleration is disabled. Add
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(LAYER_TYPE_SOFTWARE, paint);
}
and it should work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With