Loading core/java/android/widget/LinearLayout.java +24 −6 Original line number Diff line number Diff line Loading @@ -730,6 +730,7 @@ public class LinearLayout extends ViewGroup { final int baselineChildIndex = mBaselineAlignedChildIndex; final boolean useLargestChild = mUseLargestChild; int lastWeightedChildIndex = -1; int largestChildHeight = Integer.MIN_VALUE; int consumedExcessSpace = 0; Loading @@ -754,8 +755,10 @@ public class LinearLayout extends ViewGroup { } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (lp.weight > 0) { totalWeight += lp.weight; lastWeightedChildIndex = i; } final boolean useExcessSpace = lp.height == 0 && lp.weight > 0; if (heightMode == MeasureSpec.EXACTLY && useExcessSpace) { Loading Loading @@ -909,7 +912,13 @@ public class LinearLayout extends ViewGroup { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); final float childWeight = lp.weight; if (childWeight > 0) { final int share = (int) (childWeight * remainingExcess / remainingWeightSum); final int share; if (i == lastWeightedChildIndex) { share = remainingExcess; } else { share = (int) (childWeight * remainingExcess / remainingWeightSum); } remainingExcess -= share; remainingWeightSum -= childWeight; Loading Loading @@ -1070,6 +1079,7 @@ public class LinearLayout extends ViewGroup { final boolean isExactly = widthMode == MeasureSpec.EXACTLY; int lastWeightedChildIndex = -1; int largestChildWidth = Integer.MIN_VALUE; int usedExcessSpace = 0; Loading @@ -1094,8 +1104,10 @@ public class LinearLayout extends ViewGroup { } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (lp.weight > 0) { totalWeight += lp.weight; lastWeightedChildIndex = i; } final boolean useExcessSpace = lp.width == 0 && lp.weight > 0; if (widthMode == MeasureSpec.EXACTLY && useExcessSpace) { Loading Loading @@ -1294,7 +1306,13 @@ public class LinearLayout extends ViewGroup { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); final float childWeight = lp.weight; if (childWeight > 0) { final int share = (int) (childWeight * remainingExcess / remainingWeightSum); final int share; if (i == lastWeightedChildIndex) { share = remainingExcess; } else { share = (int) (childWeight * remainingExcess / remainingWeightSum); } remainingExcess -= share; remainingWeightSum -= childWeight; Loading Loading
core/java/android/widget/LinearLayout.java +24 −6 Original line number Diff line number Diff line Loading @@ -730,6 +730,7 @@ public class LinearLayout extends ViewGroup { final int baselineChildIndex = mBaselineAlignedChildIndex; final boolean useLargestChild = mUseLargestChild; int lastWeightedChildIndex = -1; int largestChildHeight = Integer.MIN_VALUE; int consumedExcessSpace = 0; Loading @@ -754,8 +755,10 @@ public class LinearLayout extends ViewGroup { } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (lp.weight > 0) { totalWeight += lp.weight; lastWeightedChildIndex = i; } final boolean useExcessSpace = lp.height == 0 && lp.weight > 0; if (heightMode == MeasureSpec.EXACTLY && useExcessSpace) { Loading Loading @@ -909,7 +912,13 @@ public class LinearLayout extends ViewGroup { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); final float childWeight = lp.weight; if (childWeight > 0) { final int share = (int) (childWeight * remainingExcess / remainingWeightSum); final int share; if (i == lastWeightedChildIndex) { share = remainingExcess; } else { share = (int) (childWeight * remainingExcess / remainingWeightSum); } remainingExcess -= share; remainingWeightSum -= childWeight; Loading Loading @@ -1070,6 +1079,7 @@ public class LinearLayout extends ViewGroup { final boolean isExactly = widthMode == MeasureSpec.EXACTLY; int lastWeightedChildIndex = -1; int largestChildWidth = Integer.MIN_VALUE; int usedExcessSpace = 0; Loading @@ -1094,8 +1104,10 @@ public class LinearLayout extends ViewGroup { } final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (lp.weight > 0) { totalWeight += lp.weight; lastWeightedChildIndex = i; } final boolean useExcessSpace = lp.width == 0 && lp.weight > 0; if (widthMode == MeasureSpec.EXACTLY && useExcessSpace) { Loading Loading @@ -1294,7 +1306,13 @@ public class LinearLayout extends ViewGroup { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); final float childWeight = lp.weight; if (childWeight > 0) { final int share = (int) (childWeight * remainingExcess / remainingWeightSum); final int share; if (i == lastWeightedChildIndex) { share = remainingExcess; } else { share = (int) (childWeight * remainingExcess / remainingWeightSum); } remainingExcess -= share; remainingWeightSum -= childWeight; Loading