Picasso showing blue red and green arrows on top c

2020-03-07 06:16发布

问题:

I am using picasso to fire up an image in imageView.

Here is the code

    ImageUtils.setImageFromUrl(app.selectedRing.getMainPicture(), imageView, MainActivity.this);


public static void setImageFromUrl(final String url, final ImageView imgView, final Context mContext)
    {
        Picasso.with(mContext)
                .load(url)
                .networkPolicy(NetworkPolicy.OFFLINE)
                .fit().centerInside().placeholder(null)
                .into(imgView, new Callback()
                {
                    @Override
                    public void onSuccess()
                    {
                    }

                    @Override
                    public void onError()
                    {
                        Picasso.with(mContext)
                                .load(url)
                                .fit().centerInside()
                                .into(imgView, new Callback()
                                {
                                    @Override
                                    public void onSuccess()
                                    {
                                    }

                                    @Override
                                    public void onError()
                                    {
                                    }
                                });
                    }
                });
    }

What i get is The problem is the blue arrow in left top corner, Sometimes its red/green. I have never seen such a thing before. and its on all the images.

What is going on.

回答1:

Use picasso.setIndicatorsEnabled(false)

Picasso.with(mContext)
                .load(url)
                .networkPolicy(NetworkPolicy.OFFLINE)
                .setIndicatorsEnabled(false)
                .fit().centerInside().placeholder(null)
                .into(imgView, new Callback()
                {
                    @Override
                    public void onSuccess()
                    {
                    }

                    @Override
                    public void onError()
                    {
                        Picasso.with(mContext)
                                .load(url)
                                .fit().centerInside()
                                .into(imgView, new Callback()
                                {
                                    @Override
                                    public void onSuccess()
                                    {
                                    }

                                    @Override
                                    public void onError()
                                    {
                                    }
                                });
                    }
                });

The color shows the source of image which is being displayed

Red color indicates that image is fetched from network.

Green color indicates that image is fetched from cache memory.

Blue color indicates that image is fetched from disk memory.