diff options
| author | Adam Powell <adamp@google.com> | 2011-01-08 16:44:07 -0800 |
|---|---|---|
| committer | Adam Powell <adamp@google.com> | 2011-01-08 16:44:07 -0800 |
| commit | 2b6be701a90a4f0aefefcf8e70feb04722e1bcfe (patch) | |
| tree | 379572c3655a358955b0d41d95d977df86819f5f /core/java/android/widget/FrameLayout.java | |
| parent | 00bba682efedbe121f31c98697f91101b1c22b82 (diff) | |
Fix bug 3312807 - Fix child margin measurement in FrameLayout
Change-Id: I5166d7b2d283c577d5f95a15b1626b068cfa6bc6
Diffstat (limited to 'core/java/android/widget/FrameLayout.java')
| -rw-r--r-- | core/java/android/widget/FrameLayout.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java index 8c7205e26618..f659eadaadbe 100644 --- a/core/java/android/widget/FrameLayout.java +++ b/core/java/android/widget/FrameLayout.java @@ -265,11 +265,13 @@ public class FrameLayout extends ViewGroup { final View child = getChildAt(i); if (mMeasureAllChildren || child.getVisibility() != GONE) { measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0); - maxWidth = Math.max(maxWidth, child.getMeasuredWidth()); - maxHeight = Math.max(maxHeight, child.getMeasuredHeight()); + final LayoutParams lp = (LayoutParams) child.getLayoutParams(); + maxWidth = Math.max(maxWidth, + child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin); + maxHeight = Math.max(maxHeight, + child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin); childState = combineMeasuredStates(childState, child.getMeasuredState()); if (measureMatchParentChildren) { - final ViewGroup.LayoutParams lp = child.getLayoutParams(); if (lp.width == LayoutParams.MATCH_PARENT || lp.height == LayoutParams.MATCH_PARENT) { mMatchParentChildren.add(child); |
