Picasso keeps reloading images while scrolling upwards in listview, loads slowly

前端 未结 5 1653
一个人的身影
一个人的身影 2021-02-08 00:04

I have been searching SO threads for answers but couldn\'t figure out my issue from previous discussion. I have a listview which loads about 50 images (it used to be about 100

5条回答
  •  无人及你
    2021-02-08 01:02

    I'd look at two things.

    Number one is the sizes of the images being loaded. I don't know what the default maximum cache size is in Picasso, but it sounds like you may be exceeding it with just a few images, causing the others to be evicted from the cache.

    Number two is probably not the core issue, but also contributes to performance. You are doing a lot findViewById() calls, which are fairly expensive. Look into the "ViewHolder" pattern for "caching" those lookups.

    Edit - see Jake Wharton's answer to a similar question for more detail

提交回复
热议问题