Move ScrollView Animator - Android android.animation

Android examples for android.animation:Animator

Description

Move ScrollView Animator

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//from  ww  w .  j av  a  2s . co  m
                .setInterpolator(new AccelerateDecelerateInterpolator());
        objectAnimator.setStartDelay(delayTime);
        if (isStart)
            objectAnimator.start();
        return objectAnimator;
    }
}

Related Tutorials