运行效果
滑动方向 | 设置行数列数 | 滚动到指定位置 |
---|---|---|
![]() |
![]() |
![]() |
滚动到指定页 | 其他操作 |
---|---|
![]() |
![]() |
ViewPager中使用 | ViewPager2中使用 |
---|---|
![]() |
![]() |
功能特点
- 复用机制和视图回收
- 支持scrollToPosition()和smoothScrollToPosition()
- 兼容输入法弹出导致onLayoutChildren()方法重新调用的问题
- 支持scrollBar
- 状态恢复
- 滑动冲突处理
引入
将JitPack存储库添加到您的项目中(项目根目录下build.gradle文件)
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
添加依赖
在您引入项目的build.gradle中添加
dependencies {
implementation 'com.github.shenbengit:PagerGridLayoutManager:Tag'
}
快速使用
注意事项
1、RecyclerView的宽高必须指定,match_parent或者例如100dp等。 (RecyclerView’s w