1

我想使用 StaggeredGridLayoutManager 有一个包含两列的垂直列表,每行有 3 个部分。我究竟应该怎么做?

4

2 回答 2

1

试试这个StaggeredGridLayotManager

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

这是使用 StaggeredGridLayotManager的教程链接

于 2017-09-13T06:58:01.843 回答
0

假设您想将其附加到回收站视图,您可以像这样添加添加

  StaggeredGridLayoutManager staggeredGridLayoutManager=new 
  StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(staggeredGridLayoutManager);

其中 recyclerView 是RecyclerView对象

于 2017-09-13T06:49:06.380 回答