diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 1ba5c05..d715ee3 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -189,8 +189,6 @@
     }
 
     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 @@
             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 @@
             child.measure(childWidthMeasureSpec, childheightMeasureSpec);
         }
 
-        setMeasuredDimension(newWidth, newHeight);
+        setMeasuredDimension(newWidth + mPaddingLeft + mPaddingRight,
+            newHeight + mPaddingTop + mPaddingBottom);
     }
 
     int getContentWidth() {
@@ -278,7 +275,8 @@
         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);
         }
     }
 
diff --git a/src/com/android/launcher2/PagedViewCellLayoutChildren.java b/src/com/android/launcher2/PagedViewCellLayoutChildren.java
index 92ff461..0907c60 100644
--- a/src/com/android/launcher2/PagedViewCellLayoutChildren.java
+++ b/src/com/android/launcher2/PagedViewCellLayoutChildren.java
@@ -92,8 +92,8 @@
             PagedViewCellLayout.LayoutParams lp =
                 (PagedViewCellLayout.LayoutParams) child.getLayoutParams();
             lp.setup(mCellWidth, mCellHeight, mWidthGap, mHeightGap,
-                    ((ViewGroup)getParent()).getPaddingLeft(),
-                    ((ViewGroup)getParent()).getPaddingTop());
+                    getPaddingLeft(),
+                    getPaddingTop());
 
             int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(lp.width,
                     MeasureSpec.EXACTLY);
@@ -111,18 +111,21 @@
         int count = getChildCount();
 
         int offsetX = 0;
-        if (mCenterContent) {
+        if (mCenterContent && count > 0) {
             // determine the max width of all the rows and center accordingly
-            int maxRowWidth = 0;
+            int maxRowX = 0;
+            int minRowX = Integer.MAX_VALUE;
             for (int i = 0; i < count; i++) {
                 View child = getChildAt(i);
                 if (child.getVisibility() != GONE) {
                     PagedViewCellLayout.LayoutParams lp =
                         (PagedViewCellLayout.LayoutParams) child.getLayoutParams();
-                    maxRowWidth = Math.max(maxRowWidth, lp.x + lp.width);
+                    minRowX = Math.min(minRowX, lp.x);
+                    maxRowX = Math.max(maxRowX, lp.x + lp.width);
                 }
             }
-            offsetX = (getMeasuredWidth() / 2) - (maxRowWidth / 2);
+            int maxRowWidth = maxRowX - minRowX;
+            offsetX = (getMeasuredWidth() - maxRowWidth) / 2;
         }
 
         for (int i = 0; i < count; i++) {
