diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:43 -0800 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2008-12-17 18:05:43 -0800 |
| commit | f013e1afd1e68af5e3b868c26a653bbfb39538f8 (patch) | |
| tree | 7ad6c8fd9c7b55f4b4017171dec1cb760bbd26bf /core/java/android/widget/LinearLayout.java | |
| parent | e70cfafe580c6f2994c4827cd8a534aabf3eb05c (diff) | |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'core/java/android/widget/LinearLayout.java')
| -rw-r--r-- | core/java/android/widget/LinearLayout.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java index de74fa4a2491..36ed8bd401d1 100644 --- a/core/java/android/widget/LinearLayout.java +++ b/core/java/android/widget/LinearLayout.java @@ -952,12 +952,13 @@ public class LinearLayout extends ViewGroup { if (majorGravity != Gravity.TOP) { switch (majorGravity) { case Gravity.BOTTOM: - childTop = mBottom - mTop - mPaddingBottom - mTotalLength; + // mTotalLength contains the padding already, we add the top + // padding to compensate + childTop = mBottom - mTop + mPaddingTop - mTotalLength; break; case Gravity.CENTER_VERTICAL: - childTop += ((mBottom - mTop - mPaddingTop - mPaddingBottom) - - mTotalLength) / 2; + childTop += ((mBottom - mTop) - mTotalLength) / 2; break; } @@ -1039,12 +1040,13 @@ public class LinearLayout extends ViewGroup { if (majorGravity != Gravity.LEFT) { switch (majorGravity) { case Gravity.RIGHT: - childLeft = mRight - mLeft - mPaddingRight - mTotalLength; + // mTotalLength contains the padding already, we add the left + // padding to compensate + childLeft = mRight - mLeft + mPaddingLeft - mTotalLength; break; case Gravity.CENTER_HORIZONTAL: - childLeft += ((mRight - mLeft - mPaddingLeft - mPaddingRight) - - mTotalLength) / 2; + childLeft += ((mRight - mLeft) - mTotalLength) / 2; break; } } |
