Fixing bug with layout of PagedViewCellLayoutChildren

This commit is contained in:
Michael Jurka committed 2011-06-02 16:41:34 -07:00
1 parent 32271c3d20
commit 2478480a97
2 files changed
+15 -14

No files matched your search

@@ -189,8 +189,6 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
}
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// TODO: currently ignoring padding
int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSpecSize = MeasureSpec.getSize(widthMeasureSpec);
@@ -233,10 +231,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
widthGap = heightGap = minGap;
}
int newWidth = mPaddingLeft + mPaddingRight + (mCellCountX * cellWidth) +
((mCellCountX - 1) * widthGap);
int newHeight = mPaddingTop + mPaddingBottom + (mCellCountY * cellHeight) +
((mCellCountY - 1) * heightGap);
int newWidth = (mCellCountX * cellWidth) + ((mCellCountX - 1) * widthGap);
int newHeight = (mCellCountY * cellHeight) + ((mCellCountY - 1) * heightGap);
final int count = getChildCount();
for (int i = 0; i < count; i++) {
@@ -248,7 +244,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
}
setMeasuredDimension(newWidth, newHeight);
setMeasuredDimension(newWidth + mPaddingLeft + mPaddingRight,
newHeight + mPaddingTop + mPaddingBottom);
}
int getContentWidth() {
@@ -278,7 +275,8 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
child.layout(0, 0, r - l, b - t);
child.layout(mPaddingLeft, mPaddingTop,
r - l - mPaddingRight, b - t - mPaddingBottom);
}
}