Recyclerview painfully slow to load cached images form Picasso

前端 未结 9 1247
夕颜
夕颜 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: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.

提交回复
热议问题