AriesHoo / FastLib

一个Android项目级快速开发框架,节约大部分写常用功能时间以实现更多项目业务功能及体验上的优化。使用说明见wiki

Home Page:https://github.com/AriesHoo/FastLib/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Demo中活动页的加载更多好像有点问题

jenkinsZhou opened this issue · comments

版本:2.2.13_beta13
加载更多的时候 明明有数据 却显示了“没有更多数据” 停留了一会又显示了数据

我现在做了个快到底加载下一页功能。可能没有控制好阈值。
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@OverRide
public void onScrolled(@nonnull RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
//判断是当前layoutManager是否为LinearLayoutManager
// 只有LinearLayoutManager才有查找第一个和最后一个可见view位置的方法
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
//获取最后一个可见view的位置
LinearLayoutManager linearManager = (LinearLayoutManager) layoutManager;
int lastPosition = linearManager.findLastVisibleItemPosition();
// 如果滑动到倒数第三条数据,就自动加载下一页数据
if (lastPosition >= layoutManager.getItemCount() - 5) {
onLoadMoreRequested();
}

        }
    });

实际项目是没有问题。我公司项目一直在用的

好的 感谢