如何在动画结束后开始活动。 我已经在xml中添加了android:oneshot =“true”,但是如何在此动画停止后开始一个新活动 。我附上了下面的整个代码。 请让我知道如何开始新的活动。如何在Android动画结束后启动开始活动
package com.appsolut.example.animation;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.widget.ImageView;
public class Animation extends Activity {
ImageView animation;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
public void onWindowFocusChanged (boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
AnimationDrawable frameAnimation =
(AnimationDrawable) animation.getBackground();
if(hasFocus) {
frameAnimation.start();
} else {
frameAnimation.stop();
}
}
public void onStart() {
{
super.onStart();
animation = (ImageView)findViewById(R.id.imageAnimation);
animation.setBackgroundResource(R.drawable.animation);
}
}
}
animation.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true" >
<item android:drawable="@drawable/img00000" android:duration="500" />
<item android:drawable="@drawable/img00001" android:duration="500" />
<item android:drawable="@drawable/img00002" android:duration="500" />
<item android:drawable="@drawable/img00003" android:duration="500" />
<item android:drawable="@drawable/img00004" android:duration="500" />
<item android:drawable="@drawable/img00005" android:duration="500" />
<item android:drawable="@drawable/img00006" android:duration="500" />
<item android:drawable="@drawable/img00007" android:duration="500" />
<item android:drawable="@drawable/img00008" android:duration="500" />
<item android:drawable="@drawable/img00009" android:duration="500" />
<item android:drawable="@drawable/img00010" android:duration="500" />
</animation-list>
加油的人,至少尝试不要只问的答案... – JoxTraex 2012-01-18 02:46:25
嗨Mr.JoxTraex,我已经尝试了许多方法,但它一直崩溃或动画只是停止了我想附加甚至是代码,但认为它会使这个过程变得复杂。我对android中的动画很陌生,所以需要一段时间,谢谢你的动机,也会这样做。 – 2012-01-18 11:46:28