Don't match wrap_content/match_parent children with child count = 1.
Bug #3328711
Change-Id: Ic131f2feecbeec4a7250d47193c9794aa70d22ee
diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java
index 2bc6301..8c7205e 100644
--- a/core/java/android/widget/FrameLayout.java
+++ b/core/java/android/widget/FrameLayout.java
@@ -297,15 +297,15 @@
resolveSizeAndState(maxHeight, heightMeasureSpec,
childState << MEASURED_HEIGHT_STATE_SHIFT));
- if (mMatchParentChildren.size() > 0) {
- count = mMatchParentChildren.size();
+ count = mMatchParentChildren.size();
+ if (count > 1) {
for (int i = 0; i < count; i++) {
final View child = mMatchParentChildren.get(i);
final MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
int childWidthMeasureSpec;
int childHeightMeasureSpec;
-
+
if (lp.width == LayoutParams.MATCH_PARENT) {
childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth() -
mPaddingLeft - mPaddingRight - lp.leftMargin - lp.rightMargin,