动画ImageView

时间:2013-05-06 11:21:58

标签: java android imageview android-animation android-imageview

目前我正在开发一款游戏。

这是我游戏的细节: 用户应选择正确的图像对象。 我希望图像从左到右加速。当他们到达终点时,他们应该再次出现在活动上。

这是我正在处理的屏幕截图:

enter image description here

我有5张图片视图,他们应该加速。你有这种动画的示例代码吗?真的很感激任何帮助。提前谢谢!

修改 试过这样做:

    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/accelerate_interpolator">
    <translate
    android:fromXDelta="-100%p"
    android:toXDelta="0%"
    android:duration="2000"/>
    </set>

但它只是从左侧滑动,没有继续动画..

1 个答案:

答案 0 :(得分:0)

您可以尝试使用Frame Animation

在你的java文件中:

imageView.setBackgroundResource(your Resource);
AnimationDrawable animte = (AnimationDrawable) imageView.getBackground();
animte.start();

可能这会对你有所帮助。