翻译动画 [英] translate animation

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

问题描述

我想要一个图像水平移动。 即形象应该从左端底角移动到右端底角一次。 没有必要再回到左端底角。

I want an image to move horizontally. i.e image should move from left end bottom corner to right end bottom corner once. No need to come back again to left end bottom corner.

我试了这件作品的code是

The piece of code which I tried was

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">

<translate android:fromXDelta="0%p" android:toXDelta="200%p" 
android:duration = "2000"/>
</set>

该移动图像由左到右。但其再次来到左侧。 谁能告诉我怎么解决这个问题?

this moves the image from left till right. But its again coming to the left side. Can anyone tell me how to solve this?

推荐答案

我知道了......而不是使用该动画的XML文件,我写在Java文件。

I got it...instead of using that animation xml file, I wrote inside java file.

Animation animation = new TranslateAnimation(0, 500,0, 0);
animation.setDuration(1000);
animation.setFillAfter(true);
myImage.startAnimation(animation);
myImage.setVisibility(0);

现在从左到右,然后它得到无形...因此动画图像移动!!! :)

Now the image moves from left to right and then it gets invisible...hence animated!!! :)

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

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