4

I am trying to draw shadow on my drawable, but the shadow gets cropped, since the rectangle I am drawing is the size of canvas.getClipBounds().

In order to draw the shadow I set the hardware acceleration on the view

view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

And I also set the Shadow Layer in my Custom Drawable

bgPaint.setShadowLayer(radius, 0, 0, Color.Black);

When I draw a small rectangle the shadow is rendered. So, I know my original problem is about the shadowing being discarded for being outside of the canvas.

I tried some approaches, such as:

Setting the Drawable's bounds,

Increasing the canvas' bounds,

Disable clipChildren on the parent view,

Overriding Drawable.getPadding()

But none of them helped me.

Eduardo Reis
  • 1,691
  • 1
  • 22
  • 45

0 Answers0