summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-07-22 15:37:14 -0400
committerAlan Viverette <alanv@google.com>2015-07-22 15:37:14 -0400
commit5b39ec8b404879225e9ef31267222fcdcbb8118c (patch)
tree724b772858154221f0ac2afe0e877e06e7e0af2e /core/java
parentb73946715cb9e3ca7a2702407e34f885e92a5d9a (diff)
downloadframeworks_base-5b39ec8b404879225e9ef31267222fcdcbb8118c.zip
frameworks_base-5b39ec8b404879225e9ef31267222fcdcbb8118c.tar.gz
frameworks_base-5b39ec8b404879225e9ef31267222fcdcbb8118c.tar.bz2
Fix handling of RelativeLayout measurement using UNSPECIFIED spec
Bug: 22613599 Change-Id: Ibdac9de1d5b53a46b29ae916e5dcc8b5c4bc9c27
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/widget/RelativeLayout.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index dac02fa..6a561e6 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -731,7 +731,8 @@ public class RelativeLayout extends ViewGroup {
// Negative values in a mySize value in RelativeLayout
// measurement is code for, "we got an unspecified mode in the
// RelativeLayout's measure spec."
- if (mySize < 0 && !mAllowBrokenMeasureSpecs) {
+ final boolean isUnspecified = mySize < 0;
+ if (isUnspecified && !mAllowBrokenMeasureSpecs) {
if (childStart != VALUE_NOT_SET && childEnd != VALUE_NOT_SET) {
// Constraints fixed both edges, so child has an exact size.
childSpecSize = Math.max(0, childEnd - childStart);
@@ -767,7 +768,7 @@ public class RelativeLayout extends ViewGroup {
if (childStart != VALUE_NOT_SET && childEnd != VALUE_NOT_SET) {
// Constraints fixed both edges, so child must be an exact size.
- childSpecMode = MeasureSpec.EXACTLY;
+ childSpecMode = isUnspecified ? MeasureSpec.UNSPECIFIED : MeasureSpec.EXACTLY;
childSpecSize = Math.max(0, maxAvailable);
} else {
if (childSize >= 0) {
@@ -784,7 +785,7 @@ public class RelativeLayout extends ViewGroup {
} else if (childSize == LayoutParams.MATCH_PARENT) {
// Child wanted to be as big as possible. Give all available
// space.
- childSpecMode = MeasureSpec.EXACTLY;
+ childSpecMode = isUnspecified ? MeasureSpec.UNSPECIFIED : MeasureSpec.EXACTLY;
childSpecSize = Math.max(0, maxAvailable);
} else if (childSize == LayoutParams.WRAP_CONTENT) {
// Child wants to wrap content. Use AT_MOST to communicate