scwang90 / SmartRefreshLayout

🔥下拉刷新、上拉加载、二级刷新、淘宝二楼、RefreshLayout、OverScroll,Android智能下拉刷新框架,支持越界回弹、越界拖动,具有极强的扩展性,集成了几十种炫酷的Header和 Footer。
https://segmentfault.com/a/1190000010066071
Apache License 2.0
24.8k stars 4.94k forks source link

当设置了EnableLoadMoreWhenContentNotFull=false并且设置了NoMoreData=true的问题 #1427

Open XiaoZhuiWang opened 2 years ago

XiaoZhuiWang commented 2 years ago

当设置EnableLoadMoreWhenContentNotFull=false,如果数据不足一个屏幕并且设置了NoMoreData=true时,当最后一条数据刚好显示在离屏幕底部一点点距离的地方,此时没有更多数据的Footer刚好就显示在屏幕外面去了,并且整个View不能滚动,导致Footer无法被滑到屏幕内。 布局是SmartRefreshLayout嵌套在CoordinatorLayout里面

XiaoZhuiWang commented 2 years ago

在没有完全熟悉源码的情况下我自己修复了一下,把 moveSpinnerInfinitely()方法中的

 if (mNestedInProgress && !mEnableLoadMoreWhenContentNotFull && spinner < 0) {
            if (!mRefreshContent.canLoadMore()) {
                /*
                 * 2019-1-22 修复 嵌套滚动模式下 mEnableLoadMoreWhenContentNotFull=false 无效的bug
                 */
                spinner = 0;
            }
        }

改为

if (mNestedInProgress && !mEnableLoadMoreWhenContentNotFull && spinner < 0) {
            if (!mRefreshContent.canLoadMore() &&
                !(mFooterNoMoreData && mRefreshFooter != null && mRefreshFooter.getView().getBottom() > thisView.getHeight())) {
                /*
                 * 2019-1-22 修复 嵌套滚动模式下 mEnableLoadMoreWhenContentNotFull=false 无效的bug
                 */
                spinner = 0;
            }
        }