Skip to content

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

@humanheima

Description

@humanheima
  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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions