Set visibility of progress bar gone on completion of image loading using Glide library

前端 未结 12 2015
栀梦
栀梦 2020-12-04 11:04

Hi I want to have a progress bar for image which will shown while image loading but when image loading will be completed I want to set it to gone. Earlier I was using Picass

12条回答
  •  执笔经年
    2020-12-04 11:50

    The above solution works pretty well for me too but when i use asBitmap() to download the image. It does not work.

    We need to use BitmapImageViewTarget

    Glide.with(this) .load(imageURL)
     .asBitmap()
     .placeholder(R.drawable.bg)
     .into(new BitmapImageViewTarget(imageView) {
                @Override
                public void onResourceReady(Bitmap  drawable, GlideAnimation anim) {
                    super.onResourceReady(drawable, anim);
                    progressBar.setVisibility(View.GONE);
                }
            });
    

提交回复
热议问题