use of com.d.xrecyclerviewf.adapter.SpaceItemDecoration in project xRecyclerViewF by Dsiner.
the class ItemTouchRvActivity method setLayoutManager.
private void setLayoutManager() {
if (isllayoutManager) {
//网格布局
if (itemDecoration == null) {
itemDecoration = new SpaceItemDecoration(10);
}
recyclerView.addItemDecoration(itemDecoration);
recyclerView.setLayoutManager(new GridLayoutManager(this, 4));
} else {
//线性布局
recyclerView.removeItemDecoration(itemDecoration);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
}
isllayoutManager = !isllayoutManager;
}
Aggregations