Glide not loading real image and stuck with placeholder

后端 未结 11 756
长情又很酷
长情又很酷 2021-02-02 05:59

I have a pretty basic load image from server line code:

Glide.with(view.getContext()).load(url).placeholder(R.drawable.default_profile).into(view);
11条回答
  •  臣服心动
    2021-02-02 06:25

    Use ProgressBar as loading gif

    Glide.with(context).
            load(url)
            .listener(new RequestListener() {
                @Override
                public boolean onException(Exception e, String model, Target target, boolean isFirstResource) {
                    progressBar.setVisibility(View.GONE);
                    return false;
                }
    
                @Override
                public boolean onResourceReady(GlideDrawable resource, String model, Target target, boolean isFromMemoryCache, boolean isFirstResource) {
                    progressBar.setVisibility(View.GONE);
                    return false;
                }
            })
            .crossFade(1000)
            .into(imageView);
    

提交回复
热议问题