in recyclerView itemAnimator android, it is possible to disable/enable auto itemAnimation animation for specific adapter position, in real time?
Try following code snippet:
val ignoreList = listOf<Int>(5, 6, 7)
recyclerView.itemAnimator = object : DefaultItemAnimator(){
override fun canReuseUpdatedViewHolder(viewHolder: RecyclerView.ViewHolder): Boolean {
if(ignoreList.contains(viewHolder.adapterPosition))
return true;
else
return super.canReuseUpdatedViewHolder(viewHolder)
}
}
You should modify ignoreList
based on your needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With