jude95 / easyrecyclerview Goto Github PK
View Code? Open in Web Editor NEWArrayAdapter,pull to refresh,auto load more,Header/Footer,EmptyView,ProgressView,ErrorView
ArrayAdapter,pull to refresh,auto load more,Header/Footer,EmptyView,ProgressView,ErrorView
如果一上来就没网,一直显示加载更多
本人懒癌,觉得还是 android:visibility="@{userInfo.videostatus==1?View.VISIBLE:View.GONE}这样方便,特别一个item里面多个图标显示隐藏。notifyDataSetChanged会刷新所有的数据,导致上面加载的数据会闪,需要增加 新增/删除/更新对应的方法
public final void notifyItemRangeChanged(int positionStart, int itemCount)
public final void notifyItemRangeInserted(int positionStart, int itemCount)
public final void notifyItemRangeRemoved(int positionStart, int itemCount)
问下新版本能不能加一个StickHeader,就是悬浮分组,类似通讯录ABCD那样的,现在自己添加了一个 但是用起来麻烦些,看下能否整合到这里面来
不足一屏时,能不显示下面的loading view么?
谢谢你提供一个这么好用的控件,在正常情况下这个控件简单易用,但是我试了一下在LayoutManager为HORIZONTAL时候loadMoreView显示不出来?是不是我的用法有问题?(通过addFooterView()可以添加显示出来, 但这样无法调用loadMoreListener)
有没有可以自定义刷新头部动画的刷新控件啊 推荐一个?
对于图片的展示或者viewholder使用GridView中图片也存在复用问题,OnBindViewHolder中处理下会更好
实现编辑列表功能好麻烦。朱大是用什么优雅的方式实现的。
类似 onRefreshComplete的方法
如题 调用这个方法没有作用 ,不会触发onRefresh事件,我是在recyclerView.setRefreshListener之后调用的
不知道这个FC是不是Easy RecyclerView造成...
Fatal Exception: java.lang.IllegalArgumentException: pointerIndex out of range
at android.view.MotionEvent.nativeGetAxisValue(MotionEvent.java)
at android.view.MotionEvent.getY(MotionEvent.java:1996)
at android.support.v4.view.MotionEventCompatEclair.getY(Unknown Source)
at android.support.v4.view.MotionEventCompat$EclairMotionEventVersionImpl.getY(Unknown Source)
at android.support.v4.view.MotionEventCompat.getY(Unknown Source)
at com.jude.easyrecyclerview.swipe.SwipeRefreshLayout.onTouchEvent(Unknown Source)
at android.view.View.dispatchTouchEvent(View.java:7127)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2144)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1905)
at com.jude.easyrecyclerview.swipe.SwipeRefreshLayout.dispatchTouchEvent(Unknown Source)
at com.jude.easyrecyclerview.EasyRecyclerView.dispatchTouchEvent(Unknown Source)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2146)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2146)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2146)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2146)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2146)
at android.view.ViewGroup.cancelAndClearTouchTargets(ViewGroup.java:2009)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1812)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1877)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1942)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1380)
at android.app.Activity.dispatchTouchEvent(Activity.java:2510)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(Unknown Source)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1890)
at android.view.View.dispatchPointerEvent(View.java:7307)
at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3174)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3119)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4155)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4134)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4226)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next(MessageQueue.java:125)
at android.os.Looper.loop(Looper.java:124)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(NativeStart.java)
mEasyRvAdapter = new EasyRvAdapter(mContext);
recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
recyclerView.setAdapter(mEasyRvAdapter);
mEasyRvAdapter.addAll(DataServer.getDataFive());
mEasyRvAdapter.setMore(R.layout.view_more, new RecyclerArrayAdapter.OnLoadMoreListener() {
@OverRide
public void onLoadMore() {
Log.d(TAG, "onLoadMore");
new Handler().postDelayed(new Runnable() {
@OverRide
public void run() {
mEasyRvAdapter.addAll(DataServer.getDataMore());
}
}, 2000);
}
});
我直接这样写,应该是可以实现加载更多的那个功能的吧。但是实际,却没有,滑动到底部还是不行,不过我用的是RecyclerView ,不是EasyRecyclerView。
还有就是,我直接clone项目,运行,在CollapsingActivity.java,将EasyRecyclerView 替换为RecyclerView ,第一次加载更的时候,不会显示loading view ,往后的第二,第三次,才有。不过代码还没细看,回家在看看,不知道是我的用法有问题,还是其他的问题。
感谢Jude95的作品。
因为需要和toolbar联动处理Toolbar的收缩变化,需要给RecylerView增加layout_behavior, 我尝试直接拷贝代码,在layout_progress_rv中增加,但layout_behavior是给CoordinatorLayout用的,编译会出错
请教使用EasyRecyclerView时怎么实现和CollapsingToolbarLayout的联动?
谢谢
嗯。
下拉刷新 请求服务器回数据的时候会闪过白屏一小会再显示出来数据,这个如何修复呢
请问,如何判断某个item在当前屏幕是否可见?
像listview的OnScrollListener这样。
ListView mListView = new ListView(getContext());
mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
我将一个viewpager塞到header里面,发现滑动的时候老是滑动不过去,手指滑动一点就又退回去了,我重写了viewpager还是没用,求解
还有,可以自动下拉加载更多么
希望取消阴影,或者让我们手动设置
设置横向的是不是直接设置LinearLaoutManager的Orientation属性就可以了啊,但是会报空指针错?为什么
用StaggeredGridLayout模式的时候 滑动速度快 item显示就出问题了 不知道作者有没有试过 还有就是'StaggeredGridLayoutManager.HORIZONTAL'有header的时候也有问题~
在EasyRecyclerView的lib中没有指定默认的loading和为空时的View。如果使用者忘记添加避免app:layout_empty="@layout/view_empty"
app:layout_progress="@layout/view_progress"
则会crash,建议在lib中添加默认view。
且:
//生成空白View
mEmpty = (ViewStub) v.findViewById(R.id.empty);
mEmpty.setLayoutResource(mEmptyId);
if (mEmptyId != 0)
mEmptyView = mEmpty.inflate();
有bug。
大兄弟,build.gradle啥编码?全是乱码
建议setRefreshingColor和setRefreshingColor两个方法使用可变参数
private void update() {
log("update");
if (recyclerView.getAdapter() instanceof RecyclerArrayAdapter) {
if (((RecyclerArrayAdapter) recyclerView.getAdapter()).getCount() == 0){
log("no data:"+((hasProgress&&!isInitialized)?"show progress":"show empty"));
if (hasProgress&&!isInitialized)recyclerView.showProgress();
else recyclerView.showEmpty();
} else{
log("has data");
recyclerView.showRecycler();
}
} else {
if (recyclerView.getAdapter().getItemCount() == 0) {
log("no data:"+((hasProgress&&!isInitialized)?"show progress":"show empty"));
if (hasProgress&&!isInitialized)recyclerView.showProgress();
else recyclerView.showEmpty();
} else{
log("has data");
recyclerView.showRecycler();
}
}
isInitialized = true;//设置Adapter时会有一次onChange。忽略此次。
process情况下,getCount()=0, 未考虑header在无数据时也需要显示的场景,导致调用showEmpty(),设置是否需要在无数据时,显示header、footer?
我getviewtype是根据每一项中的type来判断,所以在adapter里面需要getalldata,但是有个问题
我不知道应该在哪里getalldata才比较合理,我现在是在getviewtype时给list赋值,这样的话,每一次getviewtype的时候都会给list赋值,感觉很不合理,但是我又不明白应该在哪里赋值才比较好
我在adapter外调用了addall,和insertall两个方法,但是如果要在这两个方法里面getalldata的话,就需要重写他们,我设想过在notify时get,但似乎不行
希望大家可以提供一些想法
我添加了头部,但是item的数据为空,显示的空View把头部也覆盖了,如何不覆盖头部的显示EmptyView?
recyclerView.getRecyclerView().setItemAnimator(new SlideInOutLeftItemAnimator(recyclerView.getRecyclerView()));
无效果,该如何加?谢谢!
在ViewHold中 设置item.setonClickListener()没有波浪纹效果。用adapter.setonItemClick()也没有波浪纹效果,请问这个应该怎么设置出来呢?
应该填入什么呢?
在loadmoreview显示的时候再上下滑会重复加载,建议加个isloadingmore状态判断加载更多是否回调
如題
scrollbarStyle 設置 insideOverlay 沒有顯示 scrollbar
不知道是不是我問題...
我把代码clone下来导入到Android Studio中就报下面的错,不知道怎么回事啊?
Error:Unable to find method 'org.gradle.api.internal.project.ProjectInternal.getPluginManager()Lorg/gradle/api/internal/plugins/PluginManagerInternal;'.
Possible causes for this unexpected error include:
如何设置多类型的itemview,如何对setdata()的自由设值(有关联的item)?
数据不满一屏的时候底部依然会出现加载更多
//初始化adapter
mAdapter = new MessageOutboxListAdapter(getThisContext());
mList.setAdapterWithProgress(mAdapter);
mAdapter.setMore(R.layout.recyclerview_item_more, this);
代码如上,在执行onRefresh 的时候 Progress不显示呢?
目前想实现新闻业的顶部ViewPager滚动功能,现在将ViewPager添加到一个View里面,然后addHeader(View) 的时候显示空白
scrollTo(0,0)并不好使
因为要翻页,谢谢
现在这个已经足够的好了,只是提一下可能以后会用到的功能
很感谢分享,使用起来确实很方便。但是在实际使用中发现了点问题,当使用gridlayoutmanager或者staggeredgridlayoutmanager,上拉加载更多的布局有点错乱了。不知道该怎么解决的?
如题
我将一个viewpager塞到header里面,发现滑动的时候老是滑动不过去,手指滑动一点就又退回去了,我重写了viewpager还是没用,求解
Here is the fragmen of my code:
` List data = new ArrayList<>();
for(int i = 0; i < 20; i ++){
data.add("position:" + i);
}
testAdapter = new testAdapter(this);
testAdapter.addHeader(new RecyclerArrayAdapter.ItemView() {
@OverRide
public View onCreateView(ViewGroup parent) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_test, null, false);
return view;
}
@Override
public void onBindView(View headerView) {
TextView header = (TextView) headerView.findViewById(R.id.header);
header.setText("I'M HEADER");
}
});
testAdapter.notifyDataSetChanged();
testAdapter.addAll(data);
rcv.setAdapter(testAdapter);
rcv.setLayoutManager(new LinearLayoutManager(this));`
Here is the exception caught:
FATAL EXCEPTION: main
Process: com.example.zhang.recyclerviewwithheader, PID: 29336
java.lang.NullPointerException
at android.view.ViewGroup$LayoutParams.(ViewGroup.java:5929)
at android.view.ViewGroup$MarginLayoutParams.(ViewGroup.java:6211)
at android.support.v7.widget.RecyclerView$LayoutParams.(RecyclerView.java:8742)
at android.support.v7.widget.StaggeredGridLayoutManager$LayoutParams.(StaggeredGridLayoutManager.java:2050)
at com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter.createSpViewByType(RecyclerArrayAdapter.java:407)
at com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter.onCreateViewHolder(RecyclerArrayAdapter.java:427)
at com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter.onCreateViewHolder(RecyclerArrayAdapter.java:49)
at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5288)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4551)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4461)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1962)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1371)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1334)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:563)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2847)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3145)
at android.view.View.layout(View.java:14828)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at com.jude.easyrecyclerview.swipe.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:546)
at android.view.View.layout(View.java:14828)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14828)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14828)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14828)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:435)
at android.view.View.layout(View.java:14828)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14828)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:14828)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:14828)
at android.view.ViewGroup.layout(ViewGroup.java:4631)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2074)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1831)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1087)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5696)
at android.view.Ch
更新数据 必须调用 addAll(list)么?我直接更改list这个数据源的话,列表数量是不会变的,这事怎么回事,已经调用了notify了
当前界面的item个数如果不超过屏幕高度,例如当前界面只有两个item显示,会不断地执行“加载更多”回调,直到当前界面item过数超过屏幕高度,麻烦fix一下,谢谢!
我子布局有button,如何响应button,如何传递position?谢谢!
recyclerView.addItemDecoration(new RecycleViewDivider(getMyContext(), LinearLayoutManager.VERTICAL, 200, getResources().getColor(R.color.black)));
有距离,但是没有颜色
希望在ViewHolder中添加EasyRecyclerView item的点击事件和子view的点击事件,onClick和LongClick
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.