I'm using a RecyclerView. After adding items to the RecyclerView, I need to call:
notifyItemRangeInserted(int positionStart, int itemCount);
However, this shows a sort of "slide down" animation. Is there a way that I can disable this animation?
Thanks.
Open Settings . Scroll down and select Accessibility. Scroll down to Display and tap Text and display. Tap the toggle switch for Remove animations to turn it on.
To access the Accessibility features on your Android device open the Settings app . In the Settings app, select Accessibility from the list. Now scroll down to the Display section and select Remove Animations to set the toggle switch to On.
try clearing the RecyclerView
item animator
recyclerView.setItemAnimator(null);
you can re-enable your animation after if needed.
recyclerView.setItemAnimator(null); notifyItemRangeInserted(int positionStart, int itemCount); recyclerView.setItemAnimator(new DefaultItemAnimator());
You can also do it with Data Binding in your xml layout file like this:
<androidx.recyclerview.widget.RecyclerView android:id="@+id/my_recycler_view" android:layout_width="match_parent" android:layout_height="wrap_content" app:itemAnimator="@{null}" />
This is possible simply because RecyclerView has a public function called setItemAnimator
!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With