GeezerVison is showing github.com — 修复 width height wrap_content padding margin 导致 的问题 · ftyangjun/SmartRefreshLayout@c411783
File tree
Expand file treeCollapse file tree
Open diff view settings
refresh-layout-kernel/src/main/java/com/scwang/smart/refresh/layout
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: refresh-layout-kernel/src/main/java/com/scwang/smart/refresh/layout/SmartRefreshLayout.java +4-3Lines changed: 4 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -594,11 +594,12 @@ protected void onMeasure(final int widthMeasureSpec,final int heightMeasureSpec) |
594 | 594 | ((needPreview && showHeader) ? mHeaderHeight : 0) + |
595 | 595 | ((needPreview && showFooter) ? mFooterHeight : 0), lp.height); |
596 | 596 | contentView.measure(widthSpec, heightSpec); |
597 | | - minimumWidth += contentView.getMeasuredWidth(); |
598 | | - minimumHeight += contentView.getMeasuredHeight(); |
| 597 | + minimumWidth += contentView.getMeasuredWidth() + mlp.leftMargin + mlp.rightMargin; |
| 598 | + minimumHeight += contentView.getMeasuredHeight() + mlp.topMargin + mlp.bottomMargin; |
599 | 599 | } |
600 | 600 | } |
601 | | - |
| 601 | + minimumWidth += thisView.getPaddingLeft() + thisView.getPaddingRight(); |
| 602 | + minimumHeight += thisView.getPaddingTop() + thisView.getPaddingBottom(); |
602 | 603 | super.setMeasuredDimension( |
603 | 604 | View.resolveSize(Math.max(minimumWidth, super.getSuggestedMinimumWidth()), widthMeasureSpec), |
604 | 605 | View.resolveSize(Math.max(minimumHeight, super.getSuggestedMinimumHeight()), heightMeasureSpec)); |
|