saynomoo/mig4android — Issue #4: Possible one pixel off in debug rects
Author: mikaelgrev
Created: 2012-01-09 22:42:31+00:00
State: open

I think that maybe

private void drawLayoutCell(Canvas canvas)
{
canvas.drawRect(0.0F, 1.0F, getWidth(), getHeight(), cellPaint);
}

should be

private void drawLayoutCell(Canvas canvas)
{
canvas.drawRect(0.0F, 1.0F, getWidth() - 1, getHeight() - 1, cellPaint);
}

At least Swing draws the right and bottom edge of a rectangle to the right/bottom of the last pixel and one want the right and bottom edge to be inside the layout I think. If for instance you have a layout the covers the full screen the original method will at least draws the right/bottom edge outside the screen (verified on my Galaxy S2).

Cheers,
Mikael