我想运行一个动画,然后动画一个完成,第二个动画开始。我写了这段代码,但是当我运行这个程序时,动画不断地运行!并没有完成。为什么?问题是什么??
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);
}
});
}
感谢帮助