Search code examples
javaandroidstaggeredgridlayoutmanager

Work With StaggeredGridLayotManager?


I want to use a StaggeredGridLayoutManager to have a vertical list with two columns and each row has 3 parts. What exactly should I do?


Solution

  • try this to use StaggeredGridLayotManager

    private StaggeredGridLayoutManager gaggeredGridLayoutManager;
    RecyclerView recyclerView = (RecyclerView)findViewById(R.id.recycler_view);
    recyclerView.setHasFixedSize(true);    
    gaggeredGridLayoutManager = new StaggeredGridLayoutManager(2, 1);
    recyclerView.setLayoutManager(gaggeredGridLayoutManager)
    

    here is the tutorial link working with StaggeredGridLayotManager