动画的ImageView [英] Animate ImageView
问题描述
目前我正在开发一个游戏。
Currently I'm developing a game.
这是我的比赛的详细信息:
用户应该选择正确的图像对象。
我希望图像加速从左边到右边。当他们到达终点时,应在活动又重新出现。
This is the details of my game: User should choose the correct image object. I want the images to accelerate from left to right. and when they reach the end, they should re-appear on the activity again.
这是我工作的截图:
我有5 imageviews,他们应该加快。你有样品code为这种类型的动画?任何帮助是真正的AP preciated。在此先感谢!
I have 5 imageviews and they should accelerate. Do you have sample code for this type of animation? Any help is truly appreciated. Thanks in advance!
编辑:
试着这样做:
Tried doing this:
<?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>
但它只是左滑,又没有动画的延续..
But it just slides from left, and no continuation of animation..
推荐答案
您可以尝试使用的帧动画:
在你的java文件:
imageView.setBackgroundResource(your Resource);
AnimationDrawable animte = (AnimationDrawable) imageView.getBackground();
animte.start();
也许,这将帮助你。
Probably, this will help you .
这篇关于动画的ImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!