Created
December 12, 2014 18:06
-
-
Save CarlosMChica/1f1172327692b523bec0 to your computer and use it in GitHub Desktop.
how to animate transition between placeholder and image.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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