diff options
| author | Fabrice Di Meglio <fdimeglio@google.com> | 2012-12-06 23:22:31 -0800 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-12-06 23:22:31 -0800 |
| commit | aae6b552b3f9bd0bcc64761a8ea72b4ae5f6c52e (patch) | |
| tree | 154e4cdc634ce8c456ba7938bf4928f297680a4a /core/java/android/widget/RelativeLayout.java | |
| parent | 0386410ead3d0a816310685796c8f2c2a7d46f93 (diff) | |
| parent | 7ee2f7785f3f77a4d4f589fe6a488662c9ad7913 (diff) | |
am 7ee2f778: am 09329186: am b3b2922b: Merge "Fix bug #7649607 Hebrew text is cut off in Settings" into jb-mr1.1-dev
* commit '7ee2f7785f3f77a4d4f589fe6a488662c9ad7913':
Fix bug #7649607 Hebrew text is cut off in Settings
Diffstat (limited to 'core/java/android/widget/RelativeLayout.java')
| -rw-r--r-- | core/java/android/widget/RelativeLayout.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index a5eb28143fb5..dc3250fd6b0e 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -416,7 +416,7 @@ public class RelativeLayout extends ViewGroup { // We need to know our size for doing the correct computation of positioning in RTL mode if (isLayoutRtl() && (myWidth == -1 || isWrapContentWidth)) { - myWidth = getPaddingStart() + getPaddingEnd(); + int w = getPaddingStart() + getPaddingEnd(); final int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); for (int i = 0; i < count; i++) { View child = views[i]; @@ -433,8 +433,18 @@ public class RelativeLayout extends ViewGroup { } child.measure(childWidthMeasureSpec, childHeightMeasureSpec); - myWidth += child.getMeasuredWidth(); - myWidth += params.leftMargin + params.rightMargin; + w += child.getMeasuredWidth(); + w += params.leftMargin + params.rightMargin; + } + } + if (myWidth == -1) { + // Easy case: "myWidth" was undefined before so use the width we have just computed + myWidth = w; + } else { + // "myWidth" was defined before, so take the min of it and the computed width if it + // is a non null one + if (w > 0) { + myWidth = Math.min(myWidth, w); } } } |
