Android ImageView Zoom-in and Zoom-out Continuously

前端 未结 3 721
误落风尘
误落风尘 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:36

    You can use something like below and as Sanket mentioned

    Zommin.xml

    
    
        
        
    
    
    

    Zoomout.xml

    
    
        
        
    
    
    

    And the code :

    zoomin.setAnimationListener(new Animation.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) {
                    imageView.startAnimation(zoomout);
    
                }
            });
    

提交回复
热议问题