Android : how to animate transition between placeholder and image
Dev tip: how to animate transition between placeholder and image.
//Create a bitmap drawable from the bitmap to be shown
Drawable bitmapDrawable = new BitmapDrawable(context,bitmap);
Drawable[] layers = new Drawable[] {
imageView.getDrawable(), //Current placeholder
bitmapDrawable //Image to show
};
TransitionDrawable transitionDrawable = new TransitionDrawable(layers);
imageView.setImageDrawable(transitionDrawable);
int durationMillis = 1000;
transitionDrawable.startTransition(durationMillis);
Written by Mohamed Alouane
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Android
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#