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