0

In Android, we need to fill a vertical scrollview dynamically with different kind of contents, like text, titles, and images.

Every content type is managed by a Fragment, which is dynamically inflated in the root fragment which represents the view.

For background image loading we are currently using Picasso. Everything works perfectly in the article page, but the images are non refreshed/shown, apart from the first one which is immediately visible on top of the scrollview.

So, for example, if we have one image on top of the scrollview, it is immediately loaded and shown. When we scroll down, even if Picasso has downloaded the following images, they are not shown in the layout. But once we go back on the backstack and reopen again that view, all the images are shown, meaning that Picasso had correctly stored the image in the cache.

How can we force Picasso (or the Scrollview) to refresh the layout of the contained images even if they are not visible at that moment in the scrollview? Is it possible to implement lazy-loading of the images in the Scrollview? How?

Nikola Despotoski
  • 49,966
  • 15
  • 119
  • 148
Gianluca
  • 133
  • 1
  • 8
  • 1
    Without any code it would be very hard for us to look at your problem. However I can suggest using a RecyclerView instead of a ScrollView. You can use it with a [StaggeredGridLayoutManager](https://developer.android.com/reference/android/support/v7/widget/StaggeredGridLayoutManager.html) to achieve the layout you're looking for. – Benito Bertoli Jun 29 '15 at 09:30
  • Thanks Benito, we've converted the Scrollview into a RecyclerView as per your suggestion and now it works perfectly. Strange enough, the images loaded with Picasso in background into a Scrollview don't get refreshed. Thanks again – Gianluca Jun 29 '15 at 12:17

0 Answers0