Why does my ViewGroup paint incorrectly when there is an ActionBar on the screen?
I've been spinning my wheels trying to understand why my ViewGroup implementation has been malfunctioning ever since I started trying to add an ActionBar to my Activity.
I have a custom ViewGroup that lays out a set of views based on ratios related to the current width and height of the view. The ViewGroup implements a layout algorithm that is a little like absolute layout, but instead of absolute coordinates it takes coordinates relative to the  width and height of the ViewGroup.
I pretty much ignore the onMeasure pass of the layout, because I'm just going to tell the child views what their sizes will be.
The onLayout does something like the following:
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom)
{
    if (isInEditMode()) return;

    int height = getHeight();
    int width = getWidth();

    for (int i = 0; i < getChildCount(); i++)
    {
        View child = getChildAt(i);
        ImageCell cell = cells.get(i);

        int l = (int)(cell.getX0() * width);
        int t = (int)(height - (cell.getY1() * height));
        int r = (int)(cell.getX1() * width);
        int b = (int)(height - (cell.getY0() * height));

        child.layout(l, t, r, b);

        child.setBackgroundColor(0xFFFF0000);
    }
}

Unfortunately the views that are set as children of my custom ViewGroup don't paint themselves properly. These views are simple bitmap drawing views, but the bitmaps may have a scaling and translation applied to them. My View onDraw() is written something like the following:
@Override
public void onDraw(Canvas canvas) 
{

    if (canvasMatrix == null) 
    {
        canvasMatrix = new Matrix();
    }

    canvasMatrix.reset();
    canvasMatrix.setScale(scaleX, scaleY);
    canvasMatrix.postTranslate(getLeft() + translationX, getTop() + translationY);
    canvas.setMatrix(canvasMatrix);

    synchronized (renderBuffer) 
    {
        /**
         * We need to offset the renderBuffer, the scaling is done by the matrix
         * on the canvas.
         */

         canvas.drawBitmap(renderBuffer, offsetX, offsetY, null);

    }
}

I am setting up a matrix that will apply a scaling and a translation to the canvas based on the scale and translation of the images that need to be displayed. Then the images are drawn on the canvas with a specified x and y offset.
What seems to be happening is that the bitmap is painted up underneath the ActionBar, leaving a large margin of space at the bottom of the screen which is not painted. If I add a constant factor to offsetY, the bitmap can be made to paint in the correct location on the screen (depending on the rotation of the device). But I'm not sure where this constant factor should be calculated.
I understand very little about Android drawing. I would have expected the Canvas to be relative to the view's location on the screen such that if I paint at (0,0) the paint would appear at the origin of the view, not the origin of the screen. 

So this image is an example of what I am seeing. The red area at the bottom is the part of the child view that is not painted by the drawBitmap.
Any idea what I'm doing wrong here? Everything paints fine if the view is full screen, but with an ActionBar, I am not given coordinates that include the size of the ActionBar so I seem to be painting underneath it.

Your problem is here: canvas.setMatrix(canvasMatrix);
By calling this method you clobber the entire transform applied to the Canvas. There is a single Canvas for the entire window, so you are removing the transform applied to offset by the ActionBar height.
You should also always call measure() on Views. Some Views expect this call to work properly.

Thanks, Romain. I have rewritten my code now, to make sure I am not removing the original matrix, instead I am adding the appropriate scale and translations to the existing matrix. This definitely fixes my issue.

I will also ensure I call measure on all of my child views, as directed.

If you want to know more about custom layouts you should watch this talk I have on the topic: http://www.parleys.com/#id=2191&st=5

Nice, I will do that. I got my layout working so far, but even more knowledge on the subject is always helpful.
