How to implement ItemAnimator of RecyclerView to disable the animation of notifyItemChanged

前端 未结 8 1145
有刺的猬
有刺的猬 2020-12-13 03:20

In my project I need disable the \"change\" animation of RecyclerView while notifyItemChanged.

I investigated in the source of Recycl

8条回答
  •  独厮守ぢ
    2020-12-13 03:53

    Nothing of the above solutions worked for me. What worked was using the TransitionManager and setting the scene transition to null

    TransitionManager.go(new Scene(recyclerView), null);
    

    To re-enable the default animation you can create a new AutoTransition and set it to the same method above:

    AutoTransition autoTransition = new AutoTransition();
    TransitionManager.go(new Scene(recyclerView), autoTransition);
    

提交回复
热议问题