GridLayoutManager - how to auto fit columns?

后端 未结 8 2042
野性不改
野性不改 2020-11-30 18:30

I have a RecyclerView with a GridLayoutManager that displays Card Views. I want the cards to rearrange according to the screen size (the Google Play app does this kind of th

8条回答
  •  日久生厌
    2020-11-30 19:11

    Constructor new GridLayoutManager(activity, 2) is about GridLayoutManager(Context context, int spanCount) where spanCount is the number of columns in the grid.

    Best way is to check window/view width and base on this width count how many spans you want to show.

提交回复
热议问题