Android毕加索以前会显示缓存的图片

时间:2015-11-16 08:26:45

标签: android picasso

使用Picasso在RecyclerView(水平)中显示图像列表时遇到问题。我跟着这个

Picasso.with(context)
            .load(worldObj.getCover())
            .fit()
            .placeholder(R.drawable.placeholder)
            .error(R.drawable.placeholder)
            .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
            .networkPolicy(NetworkPolicy.NO_CACHE)
            .into(holder.mImageView));

但我仍然收到错误“picasso先前显示缓存的图片”

任何想法为什么我得到这个?任何帮助将不胜感激。谢谢!

更新:

@Override
public void onBindViewHolder(ViewHolder holder, final int position) {

    World worldObj = itemList.get(position);

    Picasso.with(context)
            .load(worldObj.getCover())
            .fit()
            .placeholder(R.drawable.placeholder)
            .error(R.drawable.placeholder)
            .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
            .networkPolicy(NetworkPolicy.NO_CACHE)

            .into(holder.mImageView, new Callback() {
                @Override
                public void onSuccess() {
                    // once the image is loaded, load the next image
                    Log.e("Success", "HELP");
            }

            @Override
            public void onError() {
                Log.e("Error", "HELP");
            }
    });

}

1 个答案:

答案 0 :(得分:0)

试试这个,

{{1}}

取而代之的是 skipMemoryCache(),请尝试使用适用于我的 memoryPolicy(MemoryPolicy.NO_CACHE)