move Scroll View To X ObjectAnimator - Android android.animation

Android examples for android.animation:ObjectAnimator

Description

move Scroll View To X ObjectAnimator

Demo Code


//package com.java2s;
import android.animation.Animator;

import android.animation.ObjectAnimator;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;

public class Main {
    public static Animator moveScrollViewToX(View view, int toX, int time,
            int delayTime, boolean isStart) {
        ObjectAnimator objectAnimator = ObjectAnimator.ofInt(view,
                "scrollX", new int[] { toX });
        objectAnimator.setDuration(time);
        objectAnimator/*w ww .  ja v a2s  .  co  m*/
                .setInterpolator(new AccelerateDecelerateInterpolator());
        objectAnimator.setStartDelay(delayTime);
        if (isStart)
            objectAnimator.start();
        return objectAnimator;
    }
}

Related Tutorials