This question has already been answered:

I have a RecyclerView with data, there is a TextView, ImageView, etc. I have a List with strings, the strings are the url of pictures. I would like to somehow display them, such as in Vkontakte, the screenshot below. Pictures from 0 to 10 may be in the sheet. How best to organize this thing?

Screenshot

Reported as a duplicate by members of Shwarz Andrei , pavlofff , aleksandr barakin , Community Spirit Mar 23 '16 at 11:47 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • I confused the domains :) In fact, the question is clear? - user3632418
  • one
    @YuriSPb I edited. - user3632418
  • The question is clear and there is even a similar one , but the answer is neither known to me, nor is it dumb on any other question. And I did not find any. Looks like you have to somehow implement these things yourself by measuring the pictures manually positioning them in the markup. - Yuriy SPb

1 answer 1

There are quite a large number of libraries for asynchronous loading of images with caching both on disk and in memory. The most famous are: picasso , universal image loader , glide , ion , Fresco , Volley .

Here is a link to the comparison of several libraries (English stackoverflow).

The general principle of operation: we configure the parameters (caching on disk, in memory, etc.) and give the ImageView library on the principle launched and forgotten. The library itself in a separate stream downloads the image (or takes it from the cache), reduces it to the required size and sets it in ImageView. For a quick start, just add a few lines to the adapter list. For non-standard images like svg part of the library allows you to add your decoder.

Examples of use with the code are on the pages of almost all libraries. Here is an example from picasso:

Picasso.with(context) .load("http://i.imgur.com/DvpvklR.png") .placeholder(R.drawable.image) .resize(50, 50) .into(imageView) 

In my subjective (and not the fact that the correct) opinion of UIL in this list is most flexible in terms of fine-tuning image loading, but at the same time picasso is easier to configure and implement. I did not try the ion library myself, but many people speak very well of it.

Added : Judging by the clarifications to the question, the problem is not so much in loading images by links, but in their dynamic layout on the screen. The only library that I think is suitable for this purpose is QuiltViewLibrary .

  • Hm Apparently I did not quite understand the question. What purpose? Just upload pictures to markup? Or dynamically do markup? - Shutko Alexander
  • Dynamic to do - user3632418