我正在尝试使用RecyclerView和GridLayoutManager来实现类似上图的布局。我已经尝试根据位置设置setSpanSizeLookup,但无法模仿上图中的设计。请问有人可以帮助我吗?
mRecyclerView = (RecyclerView) contentView;
mRecyclerView.setHasFixedSize(false);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 3);
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return 3 - (position % 3);
}
});
mRecyclerView.setLayoutManager(gridLayoutManager);
我所理解的是