Java tutorial
//package com.java2s; import android.view.View; import android.view.animation.TranslateAnimation; public class Main { /** * move the background view(translate animation). * * @param view * the view will be moved * @param durationMillis * translate animation duration * @param fromX * from X coordinate * @param toX * to X coordinate * @param fromY * from Y coordinate * @param toY * to Y coordinate */ public static void translate(View view, long durationMillis, boolean fillAfter, float fromX, float toX, float fromY, float toY) { TranslateAnimation ta = new TranslateAnimation(fromX, toX, fromY, toY); ta.setDuration(durationMillis); ta.setFillAfter(fillAfter);//this animation performed will persist when it is finished view.startAnimation(ta); } }