How to snap RecyclerView items so that every X items would be considered like a single unit to snap to?

后端 未结 3 1617
面向向阳花
面向向阳花 2020-11-30 01:27

Background

It\'s possible to snap a RecyclerView to its center using :

LinearSnapHelper().attachToRecyclerView(recyclerView)

Example

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-30 02:09

    I'm quiet happy with this library https://github.com/TakuSemba/MultiSnapRecyclerView. It supports:

    • snapping gravity, like start, center, end
    • snap count
    • horizontal/vertical scrolling
    • listener to be called when snapped

    Unfortunately it adds custom RecyclerView, but then it's easy to use:

    
    

提交回复
热议问题