How to clear the views which are held in the ListView's RecycleBin?

后端 未结 5 1231
梦如初夏
梦如初夏 2020-12-03 17:23

In Android\'s ListView widget, the ListView will hold the views which is got from getView method of an Adapter in a inner class

5条回答
  •  执笔经年
    2020-12-03 17:55

    There are a special method in ListView - reclaimViews(List). It moves all items that are currently in use and in recycle bin to specified list. Widget will request new views for items from Adapter before rendering next time.

    You can use reclaimed views, if there are not many changes to item structure, or scrap them completely. For example, i'm using this method to dynamically update background drawable for items when selection color was changed by user.

提交回复
热议问题