diff options
| author | 2012-12-05 17:20:51 -0800 | |
|---|---|---|
| committer | 2012-12-05 17:20:51 -0800 | |
| commit | 09329186eaf66b6c03d0ff5cc8df910800649b7d (patch) | |
| tree | d37fcbee685c773af8067c624acaf8e279fc9628 | |
| parent | 946f6ab44048138c03f9bcf93451322b4397f8f9 (diff) | |
| parent | b3b2922b10650551664659eadcf9c43cf9628974 (diff) | |
am b3b2922b: Merge "Fix bug #7649607 Hebrew text is cut off in Settings" into jb-mr1.1-dev
* commit 'b3b2922b10650551664659eadcf9c43cf9628974':
Fix bug #7649607 Hebrew text is cut off in Settings
| -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 49523a21e689..27fda24319db 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -419,7 +419,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]; @@ -436,8 +436,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); } } } |