我正在为一个视图支架滑动。但是当我滑动视图时,它会滑过2个视图保持器。
llBillView = viewHolder?.itemView?.findViewById(R.id.llBillBG)!!
val clAdd = viewHolder.itemView.findViewById<RelativeLayout>(R.id.ll)
clAdd.visibility = View.VISIBLE
if (!isSwiped) {
val translationX = Math.min(-dX, (llBillView.width / 4).toFloat())
llBillView.translationX = -translationX
// Logger.i("child draw inside $dX")
}
isSwiped = false
}```
I want to swipe only 1 view holder at a time. thanks in advance.
答案 0 :(得分:0)
从适配器正在使用的列表中删除它,并通过notifyItemRemoved(position);
通知适配器