话不多说先看效果:

实录效果视频如下
滚动居中 RecyclerView
在原有的RecyclerView 基础上操作,其他步骤不变,只是替换一下 manager 步骤
- 导入依赖
maven {
url 'https://www.jitpack.io' }
//无限滚动
implementation 'com.github.ZhaoChanghu:GalleryLayoutManager:1.1.0'
- 使用
//设置为横向,反向的反之
GalleryLayoutManager manager = new GalleryLayoutManager(RecyclerView.HORIZONTAL);
//your_recyclerView 你的RecyclerView 控件,进行绑定
manager

本文介绍了如何在RecyclerView的基础上实现滚动居中和无限滚动功能,通过引入GalleryLayoutManager库,详细展示了如何设置布局管理器、自定义Transformer以及监听滚动事件。
最低0.47元/天 解锁文章
2005

被折叠的 条评论
为什么被折叠?



