GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 修复 宽度 wrap_content 时为 0 的情况 · ftyangjun/SmartRefreshLayout@ff25c64

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • refresh-layout-kernel/src/main/java/com/scwang/smart/refresh/layout
    • SmartRefreshLayout.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎refresh-layout-kernel/src/main/java/com/scwang/smart/refresh/layout/SmartRefreshLayout.java‎

Copy file name to clipboardExpand all lines: refresh-layout-kernel/src/main/java/com/scwang/smart/refresh/layout/SmartRefreshLayout.java
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ protected void onAttachedToWindow() {
471471
*/
472472
@Override
473473
protected void onMeasure(final int widthMeasureSpec,final int heightMeasureSpec) {
474+
int minimumWidth = 0;
474475
int minimumHeight = 0;
475476
final View thisView = this;
476477
final boolean needPreview = thisView.isInEditMode() && mEnablePreviewInEditMode;
@@ -526,6 +527,7 @@ protected void onMeasure(final int widthMeasureSpec,final int heightMeasureSpec)
526527
}
527528

528529
if (needPreview && isEnableRefreshOrLoadMore(mEnableRefresh)) {
530+
minimumWidth += headerView.getMeasuredWidth();
529531
minimumHeight += headerView.getMeasuredHeight();
530532
}
531533
}
@@ -574,6 +576,7 @@ protected void onMeasure(final int widthMeasureSpec,final int heightMeasureSpec)
574576
}
575577

576578
if (needPreview && isEnableRefreshOrLoadMore(mEnableLoadMore)) {
579+
minimumWidth += footerView.getMeasuredWidth();
577580
minimumHeight += footerView.getMeasuredHeight();
578581
}
579582
}
@@ -591,13 +594,14 @@ protected void onMeasure(final int widthMeasureSpec,final int heightMeasureSpec)
591594
((needPreview && showHeader) ? mHeaderHeight : 0) +
592595
((needPreview && showFooter) ? mFooterHeight : 0), lp.height);
593596
contentView.measure(widthSpec, heightSpec);
597+
minimumWidth += contentView.getMeasuredWidth();
594598
minimumHeight += contentView.getMeasuredHeight();
595599
}
596600
}
597601

598602
super.setMeasuredDimension(
599-
View.resolveSize(super.getSuggestedMinimumWidth(), widthMeasureSpec),
600-
View.resolveSize(minimumHeight, heightMeasureSpec));
603+
View.resolveSize(Math.max(minimumWidth, super.getSuggestedMinimumWidth()), widthMeasureSpec),
604+
View.resolveSize(Math.max(minimumHeight, super.getSuggestedMinimumHeight()), heightMeasureSpec));
601605

602606
mLastTouchX = thisView.getMeasuredWidth() / 2f;
603607
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.