Create Bounce effect on ImageView - Android User Interface

Android examples for User Interface:ImageView

Description

Create Bounce effect on ImageView

Demo Code


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

import android.view.animation.BounceInterpolator;
import android.widget.ImageView;

public class Main {
    public static void animaFotoSlideLeftToRight(ImageView imageView) {
        int x = (int) imageView.getX() + 250;

        ObjectAnimator animation = ObjectAnimator.ofFloat(imageView, "x",
                0, x);/*from ww  w.  ja  va 2 s. c o  m*/
        animation.setInterpolator(new BounceInterpolator());
        animation.setDuration(1500);
        animation.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
            }
        });
        animation.start();
    }
}

Related Tutorials