gridView with different cells sizes, pinterest style

后端 未结 3 1707
囚心锁ツ
囚心锁ツ 2020-11-28 06:25

Background

GridView is a class that extends AdapterView , which means it shows cells in a grid-style efficiently, recycling old views to be shown as new ones when

3条回答
  •  隐瞒了意图╮
    2020-11-28 06:49

    Is it a bit late to answer?

    check this library from etsy. it looks very promising.

    https://github.com/etsy/AndroidStaggeredGrid

    I think it is newer version of https://github.com/maurycyw/StaggeredGridView

    .

    Updated.

    Try using RecyclerView StaggeredGridLayoutManager from google instead

        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
        recyclerView.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setAdapter(adapter);
    

提交回复
热议问题