Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CarlosMChica/1f1172327692b523bec0 to your computer and use it in GitHub Desktop.
Save CarlosMChica/1f1172327692b523bec0 to your computer and use it in GitHub Desktop.
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment