Bounce Effect on RecyclerView

I want to use the bounce effect on the RecyclerView . The bounce effect whenever I retell the contents ...

Is there a library or an example for it?

+6
source share
2 answers

I also could not find a library that supports the bounce effect for RecyclerView. In the end, I finished implementing the new library. Check out my library overscroll-bouncy-android ., It currently supports RecyclerView with LinearLayoutManager. I am also working on ListView and ScrollView.

To use my library:

Step 1:

 dependencies { compile 'com.chauthai.overscroll:overscroll-bouncy:0.1.0' } 

Step 2:

 <com.chauthai.overscroll.RecyclerViewBouncy android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="wrap_content"/> 
+9
source

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); // Some setup on the view itself. } } 
+1
source

All Articles