android – RecyclerView onClick notifyItemRemoved不会触发onBindView

我使用notifyItemRemoved()方法我想要更改其他剩余的项,但该方法不会触发onBindView()方法.

除了使用notifyDataSetChanged()之外,我该如何做到这一点.我想要具有notifyItemRemoved()方法的动画

如果您尝试从RecyclerView适配器中删除一个项目,并希望在RecyclerView中的所有列表中显示动画.

使用notifyItemRemoved(position)后使用notifyItemRangeChanged(position,getItemCount());

notifyItemRemoved(position); – notifies the RecyclerView Adapter that data in adapter has been removed at a particular position.

notifyItemRangeChanged(position, getItemCount()); – notifies the RecyclerView Adapter that positions of element in adapter has been
changed from position(removed element index to end of list), please
update it.

参考这个RecyclerView insert /remove animation的答案.

相关文章
相关标签/搜索