Java tutorial
//package com.java2s; import android.animation.ObjectAnimator; import android.view.View; public class Main { private static final String TRANSLATION_Y = "translationY"; public static ObjectAnimator tranY(View view, int duration, float pos) { float currentY = view.getTranslationY(); ObjectAnimator animator = ObjectAnimator.ofFloat(view, TRANSLATION_Y, pos, currentY); return animator.setDuration(duration); } }