Skip to content Skip to sidebar Skip to footer

Android - Animation Issue

I'm trying to slide a view up from the bottom of the screen to the top and its doing the animation but at the end it goes back to the bottom on the screen. I can't figure out why.

Solution 1:

Probably you're using old tools for animation and you've just described one of its drawbacks. Consider using Animator and changing your view's TranslationX and TranslationY properties.

One of possible examples:

yourView.animate().translationY(newY).setDuration(duration).withEndAction(new Runnable() {
    @Override
    public void run() {
        // your onAnimationEnd actions
    }
}).start();

Solution 2:

Try setting slide.setFillAfter(true)

If fillAfter is true, the transformation that this animation performed will persist when it is finished.

Or move to property animations if possible (nineoldandroids for back support) It will be much easier then.

Post a Comment for "Android - Animation Issue"