当我尝试从gif url加载到ImageView时,我通过RequestListener添加了更多条件,但它没有工作|
滑翔版:4.7.1
它在我编码时起作用:
Glide.with(context).asGif().load(gifModel.url).into(ivGif);
我想完全加载gif后,ivPreGif GONE
我添加了更多的续约,但我没有工作
Glide.with(context)
.asGif()
.load(gifModel.url)
.listener(new RequestListener<GifDrawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<GifDrawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(GifDrawable resource, Object model, Target<GifDrawable> target, DataSource dataSource, boolean isFirstResource) {
ivPreGif.setVisibility(View.GONE);
ivGif.setVisibility(View.VISIBLE);
return false;
}
})
.into(ivGif);
答案 0 :(得分:3)
试试这个..
加载方法给你的gif网址。
Glide.with(this).load(R.drawable.user).into(imageView);
Glide.with(this).load(R.drawable.user)
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
ivPreGif.setVisibility(View.GONE);
return false;
}
})
.into(imageView);