我想運行一個動畫,然後動畫完成,第二個動畫開始。我編寫這段代碼,但是當我運行這個程序時,動畫不斷運行!並沒有完成。爲什麼?問題是什麼??Animatin經常運行
public class Splash extends Activity{
Animation animation1;
Animation animation2;
Animation animation3;
ImageView image;
ImageButton circleProduct;
ImageButton circleIntroduce;
ImageButton circleMore;
ImageButton circleContact;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
animation1=AnimationUtils.loadAnimation(this, R.anim.bounce);
circleProduct=(ImageButton)findViewById(R.id.btnCircleProduct);
circleIntroduce=(ImageButton)findViewById(R.id.btnCircleIntroduce);
circleMore=(ImageButton)findViewById(R.id.btnCircleMore);
circleContact=(ImageButton)findViewById(R.id.btnCircleContact);
image=(ImageView)findViewById(R.id.img);
image.startAnimation(animation1);
animation1.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
circleProduct.setVisibility(View.VISIBLE);
circleProduct.startAnimation(animation1);
circleContact.setVisibility(View.VISIBLE);
circleContact.startAnimation(animation1);
circleIntroduce.setVisibility(View.VISIBLE);
circleIntroduce.startAnimation(animation1);
circleMore.setVisibility(View.VISIBLE);
circleMore.startAnimation(animation1);
}
});
}
感謝您的幫助