final SubsamplingScaleImageView iv = (SubsamplingScaleImageView) root.findViewById(R.id.iv); final String url = mPhotoList.get(position); //由于ssiv不是imageview,所以不能直接into进去,需要一个桥梁,那就是CustomViewTarget这个玩意 //参考:https://blog.csdn.net/elyonsaber/article/details/80082403 Glide.with(mContext).load(url).into(new CustomViewTarget<SubsamplingScaleImageView, Drawable>(iv) { @Override public void onLoadFailed(@Nullable Drawable errorDrawable) { } @Override public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) { Bitmap bitmap = ImageUtils.drawable2Bitmap(resource); iv.setImage(ImageSource.bitmap(bitmap)); } @Override protected void onResourceCleared(@Nullable Drawable placeholder) { } });
转载于:https://my.oschina.net/f839903061/blog/2120646