主要记录下3.x与4.x加载次数的区别
- Glide 3.x
Glide.with(this).load(R.drawable.test_gif).into(new GlideDrawableImageViewTarget(imageView,1)); //加载一次
- Glide 4.x
Glide.with(this).load(R.drawable.test_gif).listener(new RequestListener() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target,boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target target, DataSource dataSource,boolean isFirstResource) {
if (resourceinstanceof GifDrawable) {
//加载一次
((GifDrawable)resource).setLoopCount(1);
}
return false;
}
}).into(imageView);