Can I draw outside the bounds of an Android Canvas Can I draw outside the bounds of an Android Canvas android android

Can I draw outside the bounds of an Android Canvas


try to set

android:clipChildren="false" 

to the parent view


To draw outside the bounds, you need to expand the clipRect of the canvas.

Check out the overloaded clipRect methods on the Canvas class.

Note - You will need to specify the Region operation because the default operation is INTERSECT. So something like this:

Rect newRect = canvas.getClipBounds();newRect.inset(-5, -5)  //make the rect largercanvas.clipRect (newRect, Region.Op.REPLACE);//happily draw outside the bound now


You can draw where you like, but nothing will be saved outside the clipping rectangle.