SnappingSwipingRecyclerView is an implementation of "viewpager-like" behavior of RecyclerView, but it also adds a "long press to swipe" pattern like used in Wechat Reading, A.K.A, 微信读书, in Chinese.
You can use classes like SwipeGestureHelper
, SnappyRecyclerView
, SnappyLinearLayoutManager
, MarginDecoration
directly, just read their Java doc.
Or, you can simply use this convenient SnappingSwipingViewBuilder
class to save you some work.
RecyclerView recyclerView = new SnappingSwipingViewBuilder(this)
.setAdapter(mAdapter)
.setHeadTailExtraMarginDp(17F)
.setItemMarginDp(8F, 20F, 8F, 20F)
.setOnSwipeListener(this)
.setSnapMethod(SnappyLinearLayoutManager.SnappyLinearSmoothScroller.SNAP_CENTER)
.build();
- Add support for vertical layouts
- Add relative width support for item views