Recyclerview painfully slow to load cached images form Picasso

前端 未结 9 1118
夕颜
夕颜 2020-11-30 23:31

I have implemented a RecyclerView that contains mainly images which is loading in through Picasso. My problem is that as soon as I scroll down or up the view, the placeholde

相关标签:
9条回答
  • 2020-12-01 00:22

    Use Glide. it caches the resized image, not the full-size image, unlike Picasso. In this approach, you will lose image quality. If you want to retain the full-size quality, I suggest you use Glide to load and save the image into file storage, so whenever you need the full-size image, just access that image from file storage.

    0 讨论(0)
  • 2020-12-01 00:25

    just use noPlaceholder attribute.

    0 讨论(0)
  • 2020-12-01 00:26

    I can't verify the correctness of this solution, but I was facing this problem as well and approached it following this idea:

    @Override
    public void onBindViewHolder(ViewHolder viewHolder, final int i) {
    
    ...
    
        if(mImageView.getDrawable() == null)
             Picasso.with(context)
                .load(path)
                .error(errorResId)
                .tag(tag)
                .into(mImageView);
    ...  
    }
    

    It is intended to forbid Picasso from loading anything unless the ImageView has nothing to display.

    0 讨论(0)
提交回复
热议问题