Search in sources :

Example 1 with GridSpaceItemDecoration

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()));
}
Also used : NeteaseRefreshHeaderView(com.example.jingbin.cloudreader.view.byview.NeteaseRefreshHeaderView) StaggeredGridLayoutManager(androidx.recyclerview.widget.StaggeredGridLayoutManager) NeteaseLoadMoreView(com.example.jingbin.cloudreader.view.byview.NeteaseLoadMoreView) GridSpaceItemDecoration(me.jingbin.library.decoration.GridSpaceItemDecoration)

Aggregations

StaggeredGridLayoutManager (androidx.recyclerview.widget.StaggeredGridLayoutManager)1 NeteaseLoadMoreView (com.example.jingbin.cloudreader.view.byview.NeteaseLoadMoreView)1 NeteaseRefreshHeaderView (com.example.jingbin.cloudreader.view.byview.NeteaseRefreshHeaderView)1 GridSpaceItemDecoration (me.jingbin.library.decoration.GridSpaceItemDecoration)1