Created
January 15, 2015 06:22
-
-
Save mustafasevgi/2406dfec218594e6a8aa to your computer and use it in GitHub Desktop.
Slide animation for view
This file contains 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
// To animate view slide out from left to right | |
public void slideToRight(View view){ | |
TranslateAnimation animate = new TranslateAnimation(0,view.getWidth(),0,0); | |
animate.setDuration(500); | |
animate.setFillAfter(true); | |
view.startAnimation(animate); | |
view.setVisibility(View.GONE); | |
} | |
// To animate view slide out from right to left | |
public void slideToLeft(View view){ | |
TranslateAnimation animate = new TranslateAnimation(0,-view.getWidth(),0,0); | |
animate.setDuration(500); | |
animate.setFillAfter(true); | |
view.startAnimation(animate); | |
view.setVisibility(View.GONE); | |
} | |
// To animate view slide out from top to bottom | |
public void slideToBottom(View view){ | |
TranslateAnimation animate = new TranslateAnimation(0,0,0,view.getHeight()); | |
animate.setDuration(500); | |
animate.setFillAfter(true); | |
view.startAnimation(animate); | |
view.setVisibility(View.GONE); | |
} | |
// To animate view slide out from bottom to top | |
public void slideToTop(View view){ | |
TranslateAnimation animate = new TranslateAnimation(0,0,0,-view.getHeight()); | |
animate.setDuration(500); | |
animate.setFillAfter(true); | |
view.startAnimation(animate); | |
view.setVisibility(View.GONE); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment