Moving animation is not smooth in Android

I am trying to create an animation of a moving ball in my application, everything works fine, the ball moves as I want, but it is not smooth. I tried everything to make it smooth, but not luck every time I failed.

here is my xml code:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="true" >

    <translate
        android:duration="3000"
        android:fromXDelta="-1%p"
        android:fromYDelta="-87%p"
        android:toXDelta="1%p"
        android:toYDelta="-40%p" />

    <translate
        android:duration="3000"
        android:fromXDelta="2%p"
        android:fromYDelta="0%p"
        android:startOffset="2200"
        android:toXDelta="0%p"
        android:toYDelta="42%p" />

    <translate
        android:duration="4000"
        android:fromXDelta="0%p"
        android:fromYDelta="42%p"
        android:startOffset="4500"
        android:toXDelta="-5%p"
        android:toYDelta="0%p" />

    <translate
        android:duration="4000"
        android:fromXDelta="0%p"
        android:fromYDelta="0%p"
        android:startOffset="5500"
        android:toXDelta="4%p"
        android:toYDelta="-47%p" />


</set>

and here is my Java code:

ImageView image = (ImageView)findViewById(R.id.imageView1);
Animation anim = AnimationUtils.loadAnimation(this, R.drawable.moveing_ball_anim); 
image.startAnimation(anim);

I am moving the image in this form.

+5
source share
1 answer

You need to try using LinearInterpolator instead of AccelerateInterpolator.

Follow this link and try to implement it. You will get your decision. Link

+2
source

All Articles