移动动画的android不流畅 [英] Moving animation not smooth in android

查看:234
本文介绍了移动动画的android不流畅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个运动中的球动画在我的应用程序一切正常,将球转移,因为我想,但并不顺利。我想尽一切办法使每一次我失败了它流畅的,但没有运气。请帮我解决这个问题!

I am trying to create a moving ball animation in my app everything is working fine, ball moved as i want but it is not smooth. I tried everything to make it smooth but no luck every time i failed. Please help me to solve this!

这里是我的XML code:

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>

和这里是我的Java code:

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 move image in this shape.

推荐答案

您需要尝试使用LinearInterpolator而不是AccelerateInterpolator。

You need to try to use LinearInterpolator instead AccelerateInterpolator.

通过这个链接,并尝试实现它。你会得到你的解决方案。 <一href="http://stackoverflow.com/questions/1634252/how-to-make-a-smooth-image-rotation-in-android">Link

Go through this link, and try to implement it. You will get your solution. Link

这篇关于移动动画的android不流畅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆