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的答案.

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...