shehuan / recyclerviewadapter Goto Github PK
View Code? Open in Web Editor NEWA RecyclerView Adapter that support load more and add headerview
License: Apache License 2.0
A RecyclerView Adapter that support load more and add headerview
License: Apache License 2.0
v7版本和recyclerview版本不一致
我的解决办法是在update第一页数据之后判断一下RecyclerView是否能滚动,不能滚动就直接显示loadEndView,这个逻辑是合理的,试想一下没有更多元素可以滚动其实已经代表了没有分页这个概念了
仔细的分析可以看下这篇文章:
RecyclerView,你为什么不回调 onScrolled 方法了?
下面是我的代码:
public void updateData(List datas) {
if (isReset) {
isReset = false;
}
isLoading = false;
dataList.clear();
dataList.addAll(datas);
notifyDataSetChanged();
//判断RecyclerView是否能滚动 不能滚动就无法触发刷新 直接显示暂无更多数据
mRecyclerView.post(new Runnable() {
@OverRide
public void run() {
if (!mRecyclerView.canScrollVertically(1)) {
loadEnd();
}
}
});
}
你好,从最开始的没有任何数据到加载失败,无法从Empty View 跳转到 LoadFail View中
hello guys
setNewData is useless for me, it seems source data empty.
如果添加下拉刷新功能,在已经加载到end情况下,去下拉刷新,调用你的哪个方法重置状态,不重置的话下拉刷新后第一页下面的footerView就是end了
应该判断一下,监听事件是否为null。
您好,如果一条数据都没有加载出来,也就是没有更新adapter的数据,如何隐藏底部的加载中的view,好像没有提供这样的方法
您好,如果一条数据都没有加载出来,也就是没有更新adapter的数据,如何隐藏底部的加载中的view,好像没有提供这样的方法
布局代码如下:
<NestedScrollView>
<Other views/>
<RecyclerView />
</NestedScrollView>
滑动到列表底部后OnLoadMoreListener的onLoadMore()不会被调用,底部监听不起作用。
第一次上啦加载,还没加载完成之前。我连续上拉,会根据我上拉的次数一次性加载了多次。
如上
java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{9ef0e74 position=9 id=-1, oldPos=-1, pLpos:-1 no parent} android.support.v7.widget.RecyclerView{22c9fd9 VFED..... .F...... 0,0-1440,1974 #7f09025c app:id/recyclerView}, adapter:com.fuju.yuefang.ui.mine.attention.PersonRefreshAdapter@8a5d9e, layout:com.fuju.yuefang.ui.mine.attention.AttentionPersonFragment$2@9a4307f, context:com.fuju.yuefang.ui.mine.attention.AttentionActivity@902b432
at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5610)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5792)
at android.support.v7.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:285)
at android.support.v7.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:342)
at android.support.v7.widget.GapWorker.flushTasksWithDeadline(GapWorker.java:358)
at android.support.v7.widget.GapWorker.prefetch(GapWorker.java:365)
at android.support.v7.widget.GapWorker.run(GapWorker.java:396)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:166)
at android.app.ActivityThread.main(ActivityThread.java:7425)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)
用大神这个库,用了2年多了,一直觉得不错,唯一的缺点感觉上拉加载的控制不太好,比如有些情况会一直显示加载中,setnewdata如果数据0会报错,等等,但是总体感觉很好
您好,我在使用你这个lib的时候,不显示加载更多或者加载完成的FooterView的时候,您的Demo最下面的item显示不完成,下面的横线看不见
holder.setText(R.id.item_title, data);
我使用加载更多逻辑的时候 当我调用commonAdapter.setLoadMoreData(list); 时,如果list的长度为0的时候,会报下标越界的错误!
场景:一次加载10条数据,刚好数据有20条,所以在加载第三次的时候 服务器返回的list.size=0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.