Android examples for User Interface:View Position
set View Y Coordinate
//package com.java2s; import android.os.Build; import android.view.View; import android.view.animation.TranslateAnimation; public class Main { public static void setY(View view, float y) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) { TranslateAnimation anim = new TranslateAnimation(0, 0, y, y); anim.setFillAfter(true);//from w ww . java 2s. c o m anim.setDuration(0); view.startAnimation(anim); } else { view.setY(y); } } }