ioneday / ImageSelector

Photo picker library for Android. Support single choice、multi-choice、cropping image and preview image.
408 stars 126 forks source link

在预览界面ImagePreviewFragment中为什么加载图片一定要转成Bitmap呢? #30

Open humanheima opened 6 years ago

humanheima commented 6 years ago
  final View contentView = inflater.inflate(R.layout.fragment_preview, container, false);
        final ImageView imageView = contentView.findViewById(R.id.image);
        final PhotoViewAttacher mAttacher = new PhotoViewAttacher(imageView);
        // TODO: 2018/2/8 0008 不明白为什么要这样写
        Glide.with(this)
                .asBitmap()
                .load(new File(strUrl))
                .into(new SimpleTarget<Bitmap>(480, 800) {
                    @Override
                    public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
                        imageView.setImageBitmap(resource);
                        mAttacher.update();
                    }
                });
        return contentView;