Skip to content

Instantly share code, notes, and snippets.

@mikehibm
Last active December 13, 2015 22:19
Show Gist options
  • Save mikehibm/4983411 to your computer and use it in GitHub Desktop.
Save mikehibm/4983411 to your computer and use it in GitHub Desktop.
En example of removing a view after finishing an animation.
final ScaleAnimation scale = new ScaleAnimation(1.0f, 0.1f, 1.0f, 0.1f,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
final AlphaAnimation alpha = new AlphaAnimation(0.9f, 0.1f);
final AnimationSet set = new AnimationSet(true);
set.addAnimation(scale);
set.addAnimation(alpha);
set.setFillAfter(true);
set.setDuration(1500);
set.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationEnd(final Animation animation) {
parentView.post(new Runnable() {
@Override
public void run() {
parentView.removeView(imgView);
}
});
}
});
imgView.setAnimation(animation);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment