@@ -471,6 +471,7 @@ protected void onAttachedToWindow() { |
471 | 471 | */ |
472 | 472 | @Override |
473 | 473 | protected void onMeasure(final int widthMeasureSpec,final int heightMeasureSpec) { |
| 474 | + int minimumWidth = 0; |
474 | 475 | int minimumHeight = 0; |
475 | 476 | final View thisView = this; |
476 | 477 | final boolean needPreview = thisView.isInEditMode() && mEnablePreviewInEditMode; |
@@ -526,6 +527,7 @@ protected void onMeasure(final int widthMeasureSpec,final int heightMeasureSpec) |
526 | 527 | } |
527 | 528 |
|
528 | 529 | if (needPreview && isEnableRefreshOrLoadMore(mEnableRefresh)) { |
| 530 | + minimumWidth += headerView.getMeasuredWidth(); |
529 | 531 | minimumHeight += headerView.getMeasuredHeight(); |
530 | 532 | } |
531 | 533 | } |
@@ -574,6 +576,7 @@ protected void onMeasure(final int widthMeasureSpec,final int heightMeasureSpec) |
574 | 576 | } |
575 | 577 |
|
576 | 578 | if (needPreview && isEnableRefreshOrLoadMore(mEnableLoadMore)) { |
| 579 | + minimumWidth += footerView.getMeasuredWidth(); |
577 | 580 | minimumHeight += footerView.getMeasuredHeight(); |
578 | 581 | } |
579 | 582 | } |
@@ -591,13 +594,14 @@ protected void onMeasure(final int widthMeasureSpec,final int heightMeasureSpec) |
591 | 594 | ((needPreview && showHeader) ? mHeaderHeight : 0) + |
592 | 595 | ((needPreview && showFooter) ? mFooterHeight : 0), lp.height); |
593 | 596 | contentView.measure(widthSpec, heightSpec); |
| 597 | + minimumWidth += contentView.getMeasuredWidth(); |
594 | 598 | minimumHeight += contentView.getMeasuredHeight(); |
595 | 599 | } |
596 | 600 | } |
597 | 601 |
|
598 | 602 | 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)); |
601 | 605 |
|
602 | 606 | mLastTouchX = thisView.getMeasuredWidth() / 2f; |
603 | 607 | } |
|