Disable animation on notifyItemRangeInserted()

17,496

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());
Share:
17,496
Admin
Author by

Admin

Updated on June 19, 2022

Comments

  • Admin
    Admin about 2 years

    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.