Glide does not animate ImageView loaded from cache

I use Glide as my image downloader and want the images to fade in the background. The problem that I am facing is that it is not an animation after the image has been shown once already.

int i = 0; int[] images = { R.drawable.sunset1,R.drawable.sunset2,R.drawable.sunset3 }; if(i < images.length - 1){ i++; }else{ i = 0; } Glide.with(MainActivity.this).load(images[i]).placeholder(imageView.getDrawable()).crossFade(1000).into(imageView); 
+6
source share
1 answer

This is similar to the expected behavior for Glide. If you look at the source code of the animate method, the comment has this text:

It will be launched only if the resource was loaded asynchronously (i.e. it was not in the memory cache)

To get around this, you can simply use the ImageView#startAnimation to animate the image.

0
source

Source: https://habr.com/ru/post/977896/


All Articles