Created
November 29, 2016 13:11
-
-
Save d4rkc0de/2d78fd4ed57eb4ff35c882219bd05e46 to your computer and use it in GitHub Desktop.
Animate view locate at the bottom up/down elavation
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
public void animate(View view,Boolean up) { | |
if(up) { | |
view.setVisibility(View.VISIBLE); | |
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "translationY", view.getBottom(), 0); | |
objectAnimator.setDuration(400).setInterpolator(new DecelerateInterpolator()); | |
objectAnimator.start(); | |
} else { | |
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(view, "translationY", 0, view.getBottom()); | |
objectAnimator.setDuration(400).setInterpolator(new AccelerateInterpolator()); | |
objectAnimator.start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment