am 78186d9b: am 38848ca3: Offsetting the CellLayout by the remainder space to center it. (Bug 11030678)

* commit '78186d9b1edbaaee34cfa250d235f9b086f70dce':
  Offsetting the CellLayout by the remainder space to center it. (Bug 11030678)
This commit is contained in:
Winson Chung
2013-10-08 12:32:15 -07:00
committed by Android Git Automerger
+4 -2
View File
@@ -1009,11 +1009,13 @@ public class CellLayout extends ViewGroup {
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int offset = getMeasuredWidth() - getPaddingLeft() - getPaddingRight() -
(mCountX * mCellWidth);
int left = getPaddingLeft() + (int) Math.ceil(offset / 2f);
int top = getPaddingTop();
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
int left = getPaddingLeft();
int top = getPaddingTop();
child.layout(left, top,
left + r - l,
top + b - t);