Loading core/java/android/widget/LinearLayout.java +30 −18 Original line number Diff line number Diff line Loading @@ -723,7 +723,9 @@ public class LinearLayout extends ViewGroup { totalWeight += lp.weight; if (heightMode == MeasureSpec.EXACTLY && lp.height == 0 && lp.weight > 0) { final boolean fillExcessSpace = lp.weight > 0; final boolean hasZeroHeight = lp.height == 0; if (heightMode == MeasureSpec.EXACTLY && fillExcessSpace && hasZeroHeight) { // Optimization: don't bother measuring children who are going to use // leftover space. These views will get measured again down below if // there is any leftover space. Loading @@ -731,12 +733,12 @@ public class LinearLayout extends ViewGroup { mTotalLength = Math.max(totalLength, totalLength + lp.topMargin + lp.bottomMargin); skippedMeasure = true; } else { final boolean fillExcessSpace = lp.height == 0 && lp.weight > 0; if (fillExcessSpace) { // heightMode is either UNSPECIFIED or AT_MOST, and this // child wanted to stretch to fill available space. // Translate that to WRAP_CONTENT so that it does not end up // with a height of 0. if (fillExcessSpace && hasZeroHeight) { // The LinearLayout's heightMode is either UNSPECIFIED or // AT_MOST, and this child wanted to stretch to fill // available space. Translate the explicit height of 0 to // WRAP_CONTENT so that we can measure the view's ideal // height. lp.height = LayoutParams.WRAP_CONTENT; } Loading @@ -751,8 +753,12 @@ public class LinearLayout extends ViewGroup { final int childHeight = child.getMeasuredHeight(); if (fillExcessSpace) { usedExcessSpace += childHeight; // Restore original layout height. if (hasZeroHeight) { lp.height = 0; } } final int totalLength = mTotalLength; mTotalLength = Math.max(totalLength, totalLength + childHeight + lp.topMargin + Loading Loading @@ -1048,7 +1054,9 @@ public class LinearLayout extends ViewGroup { totalWeight += lp.weight; if (widthMode == MeasureSpec.EXACTLY && lp.width == 0 && lp.weight > 0) { final boolean fillExcessSpace = lp.weight > 0; final boolean hasZeroWidth = lp.width == 0; if (widthMode == MeasureSpec.EXACTLY && fillExcessSpace && hasZeroWidth) { // Optimization: don't bother measuring children who are going to use // leftover space. These views will get measured again down below if // there is any leftover space. Loading @@ -1075,12 +1083,12 @@ public class LinearLayout extends ViewGroup { skippedMeasure = true; } } else { final boolean fillExcessSpace = lp.width == 0 && lp.weight > 0; if (fillExcessSpace) { // widthMode is either UNSPECIFIED or AT_MOST, and this // child wanted to stretch to fill available space. // Translate that to WRAP_CONTENT so that it does not end up // with a width of 0. if (fillExcessSpace && hasZeroWidth) { // The LinearLayout's widthMode is either UNSPECIFIED or // AT_MOST, and this child wanted to stretch to fill // available space. Translate the explicit height of 0 to // WRAP_CONTENT so that we can measure the view's ideal // width. lp.width = LayoutParams.WRAP_CONTENT; } Loading @@ -1095,8 +1103,12 @@ public class LinearLayout extends ViewGroup { final int childWidth = child.getMeasuredWidth(); if (fillExcessSpace) { usedExcessSpace += childWidth; // Restore the original layout width. if (hasZeroWidth) { lp.width = 0; } } if (isExactly) { mTotalLength += childWidth + lp.leftMargin + lp.rightMargin + Loading Loading
core/java/android/widget/LinearLayout.java +30 −18 Original line number Diff line number Diff line Loading @@ -723,7 +723,9 @@ public class LinearLayout extends ViewGroup { totalWeight += lp.weight; if (heightMode == MeasureSpec.EXACTLY && lp.height == 0 && lp.weight > 0) { final boolean fillExcessSpace = lp.weight > 0; final boolean hasZeroHeight = lp.height == 0; if (heightMode == MeasureSpec.EXACTLY && fillExcessSpace && hasZeroHeight) { // Optimization: don't bother measuring children who are going to use // leftover space. These views will get measured again down below if // there is any leftover space. Loading @@ -731,12 +733,12 @@ public class LinearLayout extends ViewGroup { mTotalLength = Math.max(totalLength, totalLength + lp.topMargin + lp.bottomMargin); skippedMeasure = true; } else { final boolean fillExcessSpace = lp.height == 0 && lp.weight > 0; if (fillExcessSpace) { // heightMode is either UNSPECIFIED or AT_MOST, and this // child wanted to stretch to fill available space. // Translate that to WRAP_CONTENT so that it does not end up // with a height of 0. if (fillExcessSpace && hasZeroHeight) { // The LinearLayout's heightMode is either UNSPECIFIED or // AT_MOST, and this child wanted to stretch to fill // available space. Translate the explicit height of 0 to // WRAP_CONTENT so that we can measure the view's ideal // height. lp.height = LayoutParams.WRAP_CONTENT; } Loading @@ -751,8 +753,12 @@ public class LinearLayout extends ViewGroup { final int childHeight = child.getMeasuredHeight(); if (fillExcessSpace) { usedExcessSpace += childHeight; // Restore original layout height. if (hasZeroHeight) { lp.height = 0; } } final int totalLength = mTotalLength; mTotalLength = Math.max(totalLength, totalLength + childHeight + lp.topMargin + Loading Loading @@ -1048,7 +1054,9 @@ public class LinearLayout extends ViewGroup { totalWeight += lp.weight; if (widthMode == MeasureSpec.EXACTLY && lp.width == 0 && lp.weight > 0) { final boolean fillExcessSpace = lp.weight > 0; final boolean hasZeroWidth = lp.width == 0; if (widthMode == MeasureSpec.EXACTLY && fillExcessSpace && hasZeroWidth) { // Optimization: don't bother measuring children who are going to use // leftover space. These views will get measured again down below if // there is any leftover space. Loading @@ -1075,12 +1083,12 @@ public class LinearLayout extends ViewGroup { skippedMeasure = true; } } else { final boolean fillExcessSpace = lp.width == 0 && lp.weight > 0; if (fillExcessSpace) { // widthMode is either UNSPECIFIED or AT_MOST, and this // child wanted to stretch to fill available space. // Translate that to WRAP_CONTENT so that it does not end up // with a width of 0. if (fillExcessSpace && hasZeroWidth) { // The LinearLayout's widthMode is either UNSPECIFIED or // AT_MOST, and this child wanted to stretch to fill // available space. Translate the explicit height of 0 to // WRAP_CONTENT so that we can measure the view's ideal // width. lp.width = LayoutParams.WRAP_CONTENT; } Loading @@ -1095,8 +1103,12 @@ public class LinearLayout extends ViewGroup { final int childWidth = child.getMeasuredWidth(); if (fillExcessSpace) { usedExcessSpace += childWidth; // Restore the original layout width. if (hasZeroWidth) { lp.width = 0; } } if (isExactly) { mTotalLength += childWidth + lp.leftMargin + lp.rightMargin + Loading