毕加索将相同图像加载到活动中的多个图像视图

时间:2018-10-01 08:12:32

标签: android-studio imageview android-volley picasso

我想将3个图像从url加载到3个不同的imageViews,但毕加索将相同的图像加载到所有3个imageViews

这是我将图像加载到imageViews的代码。

Picasso.get().load(img1).networkPolicy(NetworkPolicy.NO_CACHE)
                        .memoryPolicy(MemoryPolicy.NO_CACHE).resize(120, 120).centerCrop().into(img1ELPD, new Callback() {
                    @Override
                    public void onSuccess() {
                    }

                    @Override
                    public void onError(Exception e) {
                        img1ELPD.setImageResource(R.drawable.placeholder);
                    }
                });

                Picasso.get().load(img2).networkPolicy(NetworkPolicy.NO_CACHE)
                        .memoryPolicy(MemoryPolicy.NO_CACHE).resize(512, 512).centerCrop().into(img2ELPD, new Callback() {
                    @Override
                    public void onSuccess() {
                    }

                    @Override
                    public void onError(Exception e) {
                        img2ELPD.setImageResource(R.drawable.placeholder);
                    }
                });

                Picasso.get().load(img3).networkPolicy(NetworkPolicy.NO_CACHE)
                        .memoryPolicy(MemoryPolicy.NO_CACHE).resize(512, 512).centerCrop().into(img3ELPD, new Callback() {
                    @Override
                    public void onSuccess() {
                    }

                    @Override
                    public void onError(Exception e) {
                        img3ELPD.setImageResource(R.drawable.placeholder);
                    }
                });

0 个答案:

没有答案