Android RecyclerView ItemTouchHelper 恢复滑动和恢复视图持有者 [英] Android RecyclerView ItemTouchHelper revert swipe and restore view holder

查看:19
本文介绍了Android RecyclerView ItemTouchHelper 恢复滑动和恢复视图持有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在滑动完成并在 ItemTouchHelper 上调用 onSwiped 之后恢复滑动操作并将视图持有者恢复到其初始位置.Callback 实例?我让 RecyclerViewItemTouchHelperItemTouchHelper.Callback 实例完美地协同工作,我只需要恢复滑动动作, 在某些情况下删除刷过的项目.

Is there a way to revert a swipe action and restore the view holder to its initial position after the swipe is completed and onSwiped is called on the ItemTouchHelper.Callback instance? I got the RecyclerView, ItemTouchHelper and ItemTouchHelper.Callback instances to work together perfectly, I just need to revert the swipe action and not remove the swiped item in some cases.

推荐答案

经过一些随机戳我找到了解决方案.在您的适配器上调用 notifyItemChanged.这将使刷出的视图动画回到它的原始位置.

After some random poking I found a solution. Call notifyItemChanged on you adapter. This will make the swiped out view animate back into it's original position.

这篇关于Android RecyclerView ItemTouchHelper 恢复滑动和恢复视图持有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆