diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2012-12-04 18:04:53 -0800 |
---|---|---|
committer | Fabrice Di Meglio <fdimeglio@google.com> | 2012-12-04 18:13:48 -0800 |
commit | 4e46d0fdef233c729622cc45b329adc460bb4677 (patch) | |
tree | 513eafab21969ada263991ea00d5d04b8df2000c /core | |
parent | ae5b07cac9d395d0454152d0f8141d162753d6a4 (diff) | |
download | frameworks_base-4e46d0fdef233c729622cc45b329adc460bb4677.zip frameworks_base-4e46d0fdef233c729622cc45b329adc460bb4677.tar.gz frameworks_base-4e46d0fdef233c729622cc45b329adc460bb4677.tar.bz2 |
Fix bug #7649607 Hebrew text is cut off in Settings
- in RTL mode and wrap content, make RelativeLayout respect the width that can be passed to him
Change-Id: I6029135dede1ee80e41ae1bc2a337bf52cf24445
Diffstat (limited to 'core')
-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 49523a2..27fda24 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); } } } |