Skip to content

Instantly share code, notes, and snippets.

@laurencedawson
Created February 8, 2012 05:14
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 laurencedawson/1765651 to your computer and use it in GitHub Desktop.
Save laurencedawson/1765651 to your computer and use it in GitHub Desktop.
Android animation
// An exmaple of chaning the layer type and applying
// an alpha animation to the view
view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
ObjectAnimator animator = ObjectAnimator.ofFloat(
view, View.ALPHA, 0, 1);
animator.addListener(new AnimatorListenerAdapter(){
@Override
public void onAnimationEnd(Animator animation){
view.setLayerType(View.LAYER_TYPE_NONE, null);
}
});
animator.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment