我正在开发android应用程序。当第一个动画正在进行时,我需要开始第二个动画。如何在Android应用程序中一个接一个地移动图像?
我需要在一段时间后逐一移动图像。我在main.xml中使用了两个imageViews的framelayout。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:src="@drawable/ars1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/imageView2">
</ImageView>
<ImageView android:src="@drawable/ars"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/imageView1">
</ImageView>
</FrameLayout>
下面是我的animation.xml:
<?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="-100%p"
android:duration="1500" />
</set>
在我的活动类的onCreate方法
,我在做类似下面这是行不通的。
ImageView imageView1;
ImageView imageView2;
Animation tranOut;
tranOut = AnimationUtils.loadAnimation(this, R.anim.animation);
imageView1 = (ImageView)findViewById(R.id.imageView1);
imageView1.setAnimation(tranOut);
imageView2 = (ImageView)findViewById(R.id.imageView2);
imageView2.setAnimation(tranOut);
请告诉我如何一个接一个地移动这两个图像。
由于 乔蒂
感谢您的回复。但是当第一个图像移动时,我必须开始第二个图像。所以我需要在第一个图像的动画开始时,而不是在第一个动画结束时开始第二个图像的动画。请看看你能否帮忙。 – Jyoti