Created
July 19, 2018 09:12
-
-
Save shikto1/efd3c96a266cbcc165fd554036e43b04 to your computer and use it in GitHub Desktop.
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
Animation fadeIn = new AlphaAnimation(0, 1); | |
fadeIn.setInterpolator(new DecelerateInterpolator()); //add this | |
fadeIn.setDuration(1500); | |
Animation fadeOut = new AlphaAnimation(1, 0); | |
fadeOut.setInterpolator(new AccelerateInterpolator()); //and this | |
fadeOut.setStartOffset(3000); | |
fadeOut.setDuration(1500); | |
AnimationSet animation = new AnimationSet(false); //change to false | |
animation.addAnimation(fadeIn); | |
animation.addAnimation(fadeOut); | |
alertView.startAnimation(animation); | |
animation.setAnimationListener(new Animation.AnimationListener() { | |
@Override | |
public void onAnimationStart(Animation animation) { | |
alertView.setVisibility(View.VISIBLE); | |
} | |
@Override | |
public void onAnimationEnd(Animation animation) { | |
alertView.setVisibility(View.INVISIBLE); | |
} | |
@Override | |
public void onAnimationRepeat(Animation animation) { | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment