ListView: Prevent a view from recycling

后端 未结 3 1210
予麋鹿
予麋鹿 2021-02-10 05:26

I have a ListView wich use recycled views. I\'m trying to prevent a view from recycle. So I use setHasTransientState:

android.support.v4.view.ViewCompatJB

3条回答
  •  渐次进展
    2021-02-10 05:59

    For pre Jellybean, I think you can just use setRecyclerListener on ListView and when RecyclerListener#onMovedToScrapHeap(View view) is called, clear the animation on the view who has been recycled and directly do the final job which was supposed to be done when animation ends.

    The code inside onMovedToScrapHeap(View view) depends on how you implement the animation, e.g. you can call View#clearAnimation() if you previously used View#startAnimation to start animation.

提交回复
热议问题