summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/widget/RelativeLayout.java29
1 files changed, 17 insertions, 12 deletions
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index f940226a1a60..f724e52b198c 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -695,6 +695,20 @@ public class RelativeLayout extends ViewGroup {
params.topMargin, params.bottomMargin,
mPaddingTop, mPaddingBottom,
myHeight);
+ if (params.mPreviousWidthSpec == childWidthMeasureSpec && !child.isLayoutRequested()) {
+ switch (MeasureSpec.getMode(childHeightMeasureSpec)) {
+ case MeasureSpec.EXACTLY:
+ if (child.getMeasuredHeight() == MeasureSpec.getSize(childHeightMeasureSpec)) {
+ return;
+ }
+ break;
+ case MeasureSpec.AT_MOST:
+ if (child.getMeasuredHeight() <= MeasureSpec.getSize(childHeightMeasureSpec)) {
+ return;
+ }
+ break;
+ }
+ }
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}
@@ -726,6 +740,7 @@ public class RelativeLayout extends ViewGroup {
childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.AT_MOST);
}
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
+ params.mPreviousWidthSpec = childWidthMeasureSpec;
}
/**
@@ -900,8 +915,6 @@ public class RelativeLayout extends ViewGroup {
} else if (childParams.alignWithParent && rules[LEFT_OF] != 0) {
if (myWidth >= 0) {
childParams.mRight = myWidth - mPaddingRight - childParams.rightMargin;
- } else {
- // FIXME uh oh...
}
}
@@ -926,8 +939,6 @@ public class RelativeLayout extends ViewGroup {
} else if (childParams.alignWithParent && rules[ALIGN_RIGHT] != 0) {
if (myWidth >= 0) {
childParams.mRight = myWidth - mPaddingRight - childParams.rightMargin;
- } else {
- // FIXME uh oh...
}
}
@@ -938,8 +949,6 @@ public class RelativeLayout extends ViewGroup {
if (0 != rules[ALIGN_PARENT_RIGHT]) {
if (myWidth >= 0) {
childParams.mRight = myWidth - mPaddingRight - childParams.rightMargin;
- } else {
- // FIXME uh oh...
}
}
}
@@ -958,8 +967,6 @@ public class RelativeLayout extends ViewGroup {
} else if (childParams.alignWithParent && rules[ABOVE] != 0) {
if (myHeight >= 0) {
childParams.mBottom = myHeight - mPaddingBottom - childParams.bottomMargin;
- } else {
- // FIXME uh oh...
}
}
@@ -984,8 +991,6 @@ public class RelativeLayout extends ViewGroup {
} else if (childParams.alignWithParent && rules[ALIGN_BOTTOM] != 0) {
if (myHeight >= 0) {
childParams.mBottom = myHeight - mPaddingBottom - childParams.bottomMargin;
- } else {
- // FIXME uh oh...
}
}
@@ -996,8 +1001,6 @@ public class RelativeLayout extends ViewGroup {
if (0 != rules[ALIGN_PARENT_BOTTOM]) {
if (myHeight >= 0) {
childParams.mBottom = myHeight - mPaddingBottom - childParams.bottomMargin;
- } else {
- // FIXME uh oh...
}
}
@@ -1242,6 +1245,8 @@ public class RelativeLayout extends ViewGroup {
@ViewDebug.ExportedProperty(category = "layout")
public boolean alignWithParent;
+ int mPreviousWidthSpec;
+
public LayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);