安卓动画如何停止?clearAnimation无效

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
img1 = (ImageView) findViewById(R.id.point1);
img2 = (ImageView) findViewById(R.id.point2);
img3 = (ImageView) findViewById(R.id.point3);
img4 = (ImageView) findViewById(R.id.point4);
img5 = (ImageView) findViewById(R.id.point5);
img6 = (ImageView) findViewById(R.id.point6);
img7 = (ImageView) findViewById(R.id.point7);

    mTextView = (TextView) findViewById(R.id.loading);
    textView = (TextView) findViewById(R.id.stop);
    final ObjectAnimator img1xstart = ObjectAnimator.ofFloat(img1, "scaleX", 1.0f, 1.5f);
    final ObjectAnimator img1ystart = ObjectAnimator.ofFloat(img1, "scaleY", 1.0f, 1.5f);
    final ObjectAnimator img1xend = ObjectAnimator.ofFloat(img1, "scaleX", 1.5f, 1.0f);
    final ObjectAnimator img1yend = ObjectAnimator.ofFloat(img1, "scaleY", 1.5f, 1.0f);
    final ObjectAnimator img2xstart = ObjectAnimator.ofFloat(img2, "scaleX", 1.0f, 1.5f);
    final ObjectAnimator img2ystart = ObjectAnimator.ofFloat(img2, "scaleY", 1.0f, 1.5f);
    final ObjectAnimator img2xend = ObjectAnimator.ofFloat(img2, "scaleX", 1.5f, 1.0f);
    final ObjectAnimator img2yend = ObjectAnimator.ofFloat(img2, "scaleY", 1.5f, 1.0f);
    final ObjectAnimator img3xstart = ObjectAnimator.ofFloat(img3, "scaleX", 1.0f, 1.5f);
    final ObjectAnimator img3ystart = ObjectAnimator.ofFloat(img3, "scaleY", 1.0f, 1.5f);
    final ObjectAnimator img3xend = ObjectAnimator.ofFloat(img3, "scaleX", 1.5f, 1.0f);
    final ObjectAnimator img3yend = ObjectAnimator.ofFloat(img3, "scaleY", 1.5f, 1.0f);

    mTextView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            animSet = new AnimatorSet();
            animSet.play(img1xstart).with(img1ystart);
            animSet.setDuration(500);
            animSet.start();
            animSet.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    animSet2 = new AnimatorSet();
                    animSet2.play(img2xstart).with(img2ystart);
                    animSet2.play(img1xend).with(img1yend);
                    animSet2.setDuration(500);
                    animSet2.start();
                    animSet2.addListener(new AnimatorListenerAdapter() {
                        @Override
                        public void onAnimationEnd(Animator animation) {
                            animSet3 = new AnimatorSet();
                            animSet3.play(img3xstart).with(img3ystart);
                            animSet3.play(img2xend).with(img2yend);
                            animSet3.setDuration(500);
                            animSet3.start();
                            animSet3.addListener(new AnimatorListenerAdapter() {
                                @Override
                                public void onAnimationEnd(Animator animation) {
                                    animSet.start();
                                    animSet4 = new AnimatorSet();
                                    animSet4.play(img3xend).with(img3yend);
                                    animSet4.setDuration(500);
                                    animSet4.start();
                                }
                            });
                        }
                    });
                }
            });
        }
    });

    textView.setOnClickListener(new View.OnClickListener() {//
        @TargetApi(Build.VERSION_CODES.KITKAT)
        @Override
        public void onClick(View v) {
           /* animSet.pause();
            animSet2.pause();
            animSet3.pause();
            animSet4.pause();*/
           /* animSet.end();
            animSet2.end();
            animSet3.end();*/
            // animSet4.end();

//

img1.clearAnimation();
img2.clearAnimation();
img3.clearAnimation();

       /*     animSet.cancel();
            animSet2.cancel();
            animSet3.cancel();
            animSet4.cancel();*/

        }
    });
}

这是自己实验的小圆点循环加载的程序 是很麻烦 也还在学习中。。想请教一下这里我调用什么方法才能吧这个动画循环停止掉啊?求方法。。
自己试了很多都不行

3个回答

animSet4.stop();

IDE居然没提示你stop?你是eclipse吧?

sld22525482
「已注销」 AS啊。。。
接近 3 年之前 回复

set.end( )

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!