自动滚动的RecyclerView
//设置无限滚动
AutoScrollRecyclerView.setLoopEnabled(true);
//开启自动滚动
AutoScrollRecyclerView.openAutoScroll();
//设置反向滚动
AutoScrollRecyclerView.setReverse(boolean);
//设置列表是否可手动滑动
AutoScrollRecyclerView.setCanTouch(boolean);
- 定义Interpolator,实现线性滚动
- smoothScrollBy 实现滚动效果
- 监听onScrolled方法,判断滑动结束时再次启动滑动
自定义Adapter,重写getItemCount方法,返回int无限大值
使用LayoutManager + RecyclerView.OnItemTouchListener + RecyclerView.OnScrollListener实现该功能。
通过 ASLinearLayoutManager, ASGridLayoutManager, ASStaggeredGridLayoutManager 三个LayoutManager实现。
通过LayoutManager中LayoutManagerHelper进行配置