一个可以堆叠的LinearLayoutManager
动态图 | 静态图 |
---|---|
添加jitpack
仓库
maven { url 'https://www.jitpack.io' }
添加StackLayoutManager
的依赖
implementation 'com.github.simplepeng:StackLayoutManager:v1.0.0'
直接将StackLayoutManager设置给RecyclerView
recyclerView.layoutManager = StackLayoutManager()
/**
* @param orientation 支持的方向
* @param reverseLayout 是否是逆序摆放
* @param offset item‘间偏移量
* @param changeDrawingOrder 改变默认绘制顺序
*/
class StackLayoutManager @JvmOverloads constructor(
private val orientation: Int = HORIZONTAL,
private val reverseLayout: Boolean = false,
private val offset: Int = 0,
private val changeDrawingOrder: Boolean = false
)