Java tutorial
//package com.java2s; //License from project: Apache License import android.animation.ValueAnimator; import android.view.View; public class Main { static void changeViewLeftPadding(final View view, int fromMargin, int toMargin) { ValueAnimator animator = ValueAnimator.ofFloat(fromMargin, toMargin); animator.setDuration(3000); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator valueAnimator) { float animatedValue = (float) valueAnimator.getAnimatedValue(); view.setPadding((int) animatedValue, view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom()); view.requestLayout(); } }); animator.start(); } }