使用不同的图像重新开始动画

时间:2012-04-15 16:42:52

标签: android android-animation android-imageview

我正在尝试在imageview中设置图像,按顺序运行动画。每当我尝试重置图像以重新开始动画时,它会延迟一点,动画序列会以任何方式解决这个问题吗?

    @Override
protected void onStart() {
    // TODO Auto-generated method stub
    super.onStart();



    Bitmap bitmap1 = BitmapCompressor.getInstance().compressBitmap(
            photoPaths.remove(0), 250);
    apa1.setImageBitmap(bitmap1);

    apa1.startAnimation(view_1_anim_a);

    Bitmap bitmap2 = BitmapCompressor.getInstance().compressBitmap(
            photoPaths.remove(0), 250);
    apa2.setImageBitmap(bitmap2);

    apa2.startAnimation(view_2_anim_a);

    Bitmap bitmap3 = BitmapCompressor.getInstance().compressBitmap(
            photoPaths.remove(0), 250);
    apa3.setImageBitmap(bitmap3);

    apa3.startAnimation(view_3_anim_a);




    view_1_anim_a.setAnimationListener(new AnimationListener() {

        public void onAnimationStart(Animation animation) {
            // TODO Auto-generated method stub

        }

        public void onAnimationRepeat(Animation animation) {
            // TODO Auto-generated method stub

        }

        public void onAnimationEnd(Animation animation) {
            // TODO Auto-generated method stub

            apa1.startAnimation(view_1_anim_b);

        }
    });

    view_1_anim_b.setAnimationListener(new AnimationListener() {

        public void onAnimationStart(Animation animation) {
            // TODO Auto-generated method stub

        }

        public void onAnimationRepeat(Animation animation) {
            // TODO Auto-generated method stub

        }

        public void onAnimationEnd(Animation animation) {
            // TODO Auto-generated method stub
            apa1.startAnimation(view_1_anim_c);

        }
    });

    view_1_anim_c.setAnimationListener(new AnimationListener() {

        public void onAnimationStart(Animation animation) {
            // TODO Auto-generated method stub

        }

        public void onAnimationRepeat(Animation animation) {
            // TODO Auto-generated method stub

        }

        public void onAnimationEnd(Animation animation) {
            // TODO Auto-generated method stub

            apa1.startAnimation(view_1_anim_d);


        }
    });

    view_1_anim_d.setAnimationListener(new AnimationListener() {

        public void onAnimationStart(Animation animation) {


        }

        public void onAnimationRepeat(Animation animation) {
            // TODO Auto-generated method stub

        }

        public void onAnimationEnd(Animation animation) {
            Bitmap bitmap1 = BitmapCompressor.getInstance().compressBitmap(
                    photoPaths.remove(0), 250);
            apa4.setImageBitmap(bitmap1);

            apa4.startAnimation(view_1_anim_a)://HERE IT IS DELAYED A BIT AND THE SEQUENCE IS RUINED
        }
    });

0 个答案:

没有答案