I am trying to implement a ViewPager-like behavior for a horizontal RecyclerView . Data from the adapter should be inflated and bound as usual, but switching through the Recycler should be done differently. When the user scrolls (or tries to scroll), I move the Recycler one element in that direction, holding it to the left.
I already have all the element transition logic. I am using a custom LayoutManager that overrides onSmoothScrollToPosition() with a custom LinearSmoothScroller() that makes the item to its left.
Question: how can I cancel the RecyclerView scroll behavior to intercept swipes and handle them myself? I tried disabling scrolling in the LayoutManager and then intercepted the gesture in onTouchListener , but this does not seem to work. Does the RecyclerView structure have a clean way to handle this?
source share