如何在从Back4App的Parse获取的图像(.GIF)中实现Glide?

时间:2019-07-02 14:49:59

标签: java android xml android-glide

我目前使用PNG类型的图像在移动应用程序中显示类别的图标。 我想为GIF类型的图像更改这些静态图标,因为我想使用Glide。

我正在尝试更改,但无法识别我

with (this)

它告诉我一个错误。

public class BrowseCategoryVH extends RecyclerView.ViewHolder implements View.OnClickListener {

        private TextView titleTV;
        private ImageView imageIV;
        private ProgressBar loadingPB;

        public BrowseCategoryVH(View itemView) {
            super(itemView);
            itemView.setOnClickListener(this);

            titleTV = itemView.findViewById(R.id.ibc_title_tv);
            imageIV = itemView.findViewById(R.id.ibc_image_iv);
            loadingPB = itemView.findViewById(R.id.ibc_loading_pb);
        }

        private void loadImage() {
            loadingPB.setVisibility(View.VISIBLE);

            ParseObject categoryObj = categories.get(getAdapterPosition());
            ImageLoadingUtils.loadImage(categoryObj, Configs.CATEGORIES_IMAGE, new ImageLoadingUtils
                    .OnImageLoadListener() {
                @Override
                public void onImageLoaded(Bitmap bitmap) {
                    loadingPB.setVisibility(View.GONE);
                    imageIV.setImageBitmap(bitmap);
                }

                @Override
                public void onImageLoadingError() {
                    loadingPB.setVisibility(View.GONE);
                    imageIV.setImageBitmap(null);
                    //todo show placeholder
                }
            });
        }

        @Override
        public void onClick(View v) {
            if (onCategorySelectedListener != null) {
                ParseObject categoryObj = categories.get(getAdapterPosition());
                onCategorySelectedListener.onCategorySelected(categoryObj);
            }
        }
    }

我想要的是实现Glide,以使该类别的图像具有动画效果,因为现在上传到Parse的文件是GIF而不是PNG图像。 在这一行:

Glide.with(this).load(loadImage).into(imageIV);

0 个答案:

没有答案