GridLayoutManager - how to auto fit columns?

后端 未结 8 2047
野性不改
野性不改 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:09

    The GridLayoutManager's constructor has an argument spanCount that is

    The number of columns in the grid

    You can initialize the manager with an integer resource value and provide different values for different screens (i.e. values-w600, values-large, values-land).

提交回复
热议问题