Android translate animation – permanently move View to new position using AnimationListener

I usually prefer to work with deltas in translate animation, since it avoids a lot of confusion.

Try this out, see if it works for you:

TranslateAnimation anim = new TranslateAnimation(0, amountToMoveRight, 0, amountToMoveDown);

anim.setAnimationListener(new TranslateAnimation.AnimationListener() {

    public void onAnimationStart(Animation animation) { }

    public void onAnimationRepeat(Animation animation) { }

    public void onAnimationEnd(Animation animation) 
        FrameLayout.LayoutParams params = (FrameLayout.LayoutParams)view.getLayoutParams();
        params.topMargin += amountToMoveDown;
        params.leftMargin += amountToMoveRight;


Make sure to make amountToMoveRight / amountToMoveDown final

Hope this helps 🙂

Leave a Comment