ListView: Prevent a view from recycling

后端 未结 3 1205
予麋鹿
予麋鹿 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:58

    Besides the animation problem Daniel talked about, another issue where knowing when your view is recycled has to do with memory management. If you are putting large, memory intensive bitmaps in your list items, it may be possible that you don't want your view recycled if its not likely to be re-used by other items. This hook gives you a chance to clear the bitmap you may have assigned to an ImageView. Hopefully, this is a rare problem.

提交回复
热议问题