android: when linearlayout set weight,should count space when calculate total length
This commit is contained in:
parent
3b0f13bb99
commit
c7e6f93955
@ -854,6 +854,9 @@ public class DoricLinearLayoutCompat extends ViewGroup {
|
|||||||
final int totalLength = mTotalLength;
|
final int totalLength = mTotalLength;
|
||||||
mTotalLength = Math.max(totalLength, totalLength + child.getMeasuredHeight() +
|
mTotalLength = Math.max(totalLength, totalLength + child.getMeasuredHeight() +
|
||||||
lp.topMargin + lp.bottomMargin + getNextLocationOffset(child));
|
lp.topMargin + lp.bottomMargin + getNextLocationOffset(child));
|
||||||
|
if (hasDividerBeforeChildAt(i)) {
|
||||||
|
mTotalLength += mDividerHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add in our padding
|
// Add in our padding
|
||||||
@ -1234,7 +1237,9 @@ public class DoricLinearLayoutCompat extends ViewGroup {
|
|||||||
mTotalLength = Math.max(totalLength, totalLength + child.getMeasuredWidth() +
|
mTotalLength = Math.max(totalLength, totalLength + child.getMeasuredWidth() +
|
||||||
lp.leftMargin + lp.rightMargin + getNextLocationOffset(child));
|
lp.leftMargin + lp.rightMargin + getNextLocationOffset(child));
|
||||||
}
|
}
|
||||||
|
if (mTotalLength > 0 && hasDividerBeforeChildAt(count)) {
|
||||||
|
mTotalLength += mDividerWidth;
|
||||||
|
}
|
||||||
boolean matchHeightLocally = heightMode != MeasureSpec.EXACTLY &&
|
boolean matchHeightLocally = heightMode != MeasureSpec.EXACTLY &&
|
||||||
lp.height == LayoutParams.MATCH_PARENT;
|
lp.height == LayoutParams.MATCH_PARENT;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user