将LinearLayoutManager更改为GridLayoutManager

时间:2018-11-28 04:10:52

标签: gridlayoutmanager linearlayoutmanager

private void setUpRecyclerView() {
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerViewAdapter = new StoryAdapter(MainActivity.this, getData());
recyclerView.setAdapter(recyclerViewAdapter);
recyclerViewAdapter.notifyDataSetChanged();
}
private ArrayList<Object> getData() {

好人帮我实现gridlayoutmanager吗?

有1张照片就可以了

https://i.imgur.com/d9sPssi.png

2张照片,所以我想离开某人可以帮助我吗?

https://i.imgur.com/VyIZwPe.png enter image description here

我在注释中留下了代码。

1 个答案:

答案 0 :(得分:0)

在这里看看-https://medium.com/@alla.dubovska/android-recyclerview-animated-transition-between-grid-and-list-layouts-b2309e1d9f19

本文介绍了Grid和List布局之间的RecyclerView动画过渡。