Android animation does not repeat

后端 未结 23 1456
囚心锁ツ
囚心锁ツ 2020-11-27 14:01

I\'m trying to make simple animation that would repeat several times (or infinitely).
It seems that android:repeatCount does not work!
Here is my anim

23条回答
  •  眼角桃花
    2020-11-27 14:15

    Little tweak to @Danufr answer to save resources from loading again.

        operator = (ImageView) findViewById(R.id.operator_loading);
      final  Animation ani = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.finding_operator);
    
    
        ani.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
    
            }
    
            @Override
            public void onAnimationEnd(Animation animation) {
    
                operator.startAnimation(ani);
    
            }
    
            @Override
            public void onAnimationRepeat(Animation animation) {
    
            }
        });
    
        operator.setAnimation(ani);
    

提交回复
热议问题