You can use this library https://github.com/EverythingMe/overscroll-decor So, you need to create your own ScrollDecorAdapter, like this
public class CustomRecyclerViewOverScrollDecorAdapter extends RecyclerViewOverScrollDecorAdapter { RecyclerView mRecyclerView; public CustomRecyclerViewOverScrollDecorAdapter(RecyclerView recyclerView) { super(recyclerView); mRecyclerView = recyclerView; } @Override public boolean isInAbsoluteEnd() { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) mRecyclerView.getLayoutManager(); if (linearLayoutManager.getOrientation() == LinearLayoutManager.HORIZONTAL) { return !mRecyclerView.canScrollHorizontally(1); } else { return !mRecyclerView.canScrollVertically(1); } } }
And now in your fragment / activity use
CustomVerticalOverScrollDecorator overScrollDecorator = new CustomVerticalOverScrollDecorator(new CustomRecyclerViewOverScrollDecorAdapter(yourRecyclerView));
Where is CustomVerticalOverScrollDecorator smth like this
public class CustomVerticalOverScrollDecorator extends VerticalOverScrollBounceEffectDecorator { public CustomVerticalOverScrollDecorator(IOverScrollDecoratorAdapter viewAdapter) { this(viewAdapter, DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD, DEFAULT_TOUCH_DRAG_MOVE_RATIO_BCK, DEFAULT_DECELERATE_FACTOR); } public CustomVerticalOverScrollDecorator(IOverScrollDecoratorAdapter viewAdapter, float touchDragRatioFwd, float touchDragRatioBck, float decelerateFactor) { super(viewAdapter, touchDragRatioFwd, touchDragRatioBck, decelerateFactor);
source share