Android ImageView Zoom-in and Zoom-out Continuously

前端 未结 3 731
误落风尘
误落风尘 2021-02-07 11:23

Is there any way to Zoom-in and Zoom-out an ImageView continuously in Android. I tried using the below code, but only one of the Zoom function is working.

3条回答
  •  再見小時候
    2021-02-07 11:55

    use this instead of thread

     zoomin.setAnimationListener(new AnimationListener() {
    
            @Override
            public void onAnimationStart(Animation arg0) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onAnimationRepeat(Animation arg0) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onAnimationEnd(Animation arg0) {
                bgImage.startAnimation(zoomout); 
    
            }
        });
    

    and

     zoomout.setAnimationListener(new AnimationListener() {
    
            @Override
            public void onAnimationStart(Animation arg0) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onAnimationRepeat(Animation arg0) {
                // TODO Auto-generated method stub
    
            }
    
            @Override
            public void onAnimationEnd(Animation arg0) {
                bgImage.startAnimation(zoomin); 
    
            }
        });
    

提交回复
热议问题