use of me.jingbin.library.decoration.GridSpaceItemDecoration in project CloudReader by youlookwhat.
the class RefreshHelper method initStaggeredGrid.
public static void initStaggeredGrid(ByRecyclerView recyclerView, int spanCount, int spacing) {
recyclerView.setLayoutManager(new StaggeredGridLayoutManager(spanCount, StaggeredGridLayoutManager.VERTICAL));
// 如果每个item高度一致设置后效率更高
recyclerView.setHasFixedSize(true);
// recyclerView.setItemAnimator(null);
recyclerView.addItemDecoration(new GridSpaceItemDecoration(spacing));
recyclerView.setRefreshHeaderView(new NeteaseRefreshHeaderView(recyclerView.getContext()));
recyclerView.setLoadingMoreView(new NeteaseLoadMoreView(recyclerView.getContext()));
}
Aggregations