ChipsLayoutManager
介绍:
自定义LayoutManager实现的一个可回收的流式布局,当item排满一行自动从新的一行开始。
运行效果:
使用说明:
依赖
compile 'com.beloo.widget:ChipsLayoutManager:0.1.2'
例子
ChipsLayoutManager chipsLayoutManager = ChipsLayoutManager.newBuilder()
//set vertical gravity for all items in a row. Default = Gravity.CENTER_VERTICAL
.setChildGravity(Gravity.TOP)
//whether RecyclerView can scroll
.setScrollingEnabled(true)
//set maximum views count in a particular row
.setMaxViewsInRow(2)
//set gravity resolver where you can determine gravity for item in position. This method have priority over previous one
.setGravityResolver(new IChildGravityResolver() {
@Override
public int getItemGravity(int position) {
return Gravity.CENTER;
}
})
.build();
rv.setLayoutManager(chipsLayoutManager);
已下载
0