I would like to apply a fade-in animation to an ImageView to create the effect that the image, which is loaded from a url, fades in when the download is completed.
I know how to download an image from a url to an ImageView, like in this answer, and I know how to apply a fade-in animation to an imageView like here.
This attempt
Drawable d = ImageUtils.fetchDrawable("the url");
imageView.setImageDrawable(d);
imageView.startAnimation(fadeInAnimation);
results in a blink effect (see, not see, fade in to see). Reversing the order of the two last lines also results in a blink.
I've googled and searched SO for a solution in the form of a callback / listener - something like this:
imageView.setOnLoadCompleteListener...
to register the loading complete event in ImageView but I haven't found anything along those lines.
I'd be grateful for any pointers to a solution on how to implement this effect.
You can use: TransitionDrawable, simple code as follows:
set the
ImageView
visibility toINVISIBLE
orGONE
setsetAnimationListener
on your animation. and when theonAnimationEnd
change the visibility of theImageView
.