目前我正在开发一款游戏。
这是我的游戏的详细信息:
用户应选择正确的图像对象。
我希望图像从左到右加速。当他们到达终点时,他们应该再次出现在活动中。
这是我正在处理的屏幕截图:
我有 5 个图像视图,它们应该会加速。您有此类动画的示例代码吗?非常感谢任何帮助。提前致谢!
EDIT:尝试这样做:
<?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>
但它只是从左边滑动,并且没有继续动画。
您可以尝试使用帧动画 http://developer.android.com/guide/topics/resources/animation-resource.html#Frame :
在你的java文件中:
imageView.setBackgroundResource(your Resource);
AnimationDrawable animte = (AnimationDrawable) imageView.getBackground();
animte.start();
也许,这会对你有所帮助。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)