Can I draw outside the bounds of an Android Canvas

Solution 1:

try to set

android:clipChildren="false" 

to the parent view

Solution 2:

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 larger

canvas.clipRect (newRect, Region.Op.REPLACE);
//happily draw outside the bound now