问题描述
有没有办法在滑动完成并在 ItemTouchHelper 上调用
实例?我让 onSwiped
之后恢复滑动操作并将视图持有者恢复到其初始位置.CallbackRecyclerView
、ItemTouchHelper
和 ItemTouchHelper.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 恢复滑动和恢复视图持有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!