Skip to content

Commit

Permalink
fix: #263 自定义侧滑移动的视图android:tag="swipe"复用问题
Browse files Browse the repository at this point in the history
  • Loading branch information
liangjingkanji committed Sep 17, 2022
1 parent 736cf1e commit 90e08ad
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ open class DefaultItemTouchCallback : ItemTouchHelper.Callback() {
return 1f
}

override fun clearView(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder) {
super.clearView(recyclerView, viewHolder)
val view = viewHolder.itemView.findViewWithTag<View>("swipe")
if (view != null) {
view.translationX = 0F
}
}

/**
* 当拖拽动作完成且松开手指时触发
* @param source 触发拖拽的Item
Expand Down

0 comments on commit 90e08ad

Please sign in to comment.