2013-10-01 53 views
1

我正在使用下面的代碼的翻轉我ViewFlipper動畫完成 - Android?

viewFlipper.setOnClickListener(new OnClickListener() { 
         @Override 
         public void onClick(View v) { 
           // This is all you need to do to 3D flip 
           AnimationFactory.flipTransition(viewFlipper, FlipDirection.LEFT_RIGHT); 
         } 

     }); 

如何附上聽衆一旦flipTransition完成?任何指針?

回答

3

您可以像這樣從flipperView獲取動畫。

imageViewFlipper.getAnimation().setAnimationListener(new Animation.AnimationListener() { 
        public void onAnimationStart(Animation animation) {} 
        public void onAnimationRepeat(Animation animation) {} 
        public void onAnimationEnd(Animation animation) { 
         //your code after animation end 
        } 
       }); 

測試,對我來說

+0

我要高度爲ViewFlipper這個動畫聽衆進行了代碼? ?或ViewFlipper內的imageview? – Naveen

+0

是的,你必須註冊ViewFlipper列表器 –

0

工作使用setAnimationListener() 這將幫助你獲得3種方法即

   public void onAnimationStart(Animation animation) 
       public void onAnimationRepeat(Animation animation) 
       public void onAnimationEnd(Animation animation) 

做出相應的代碼。

onAnimationStart()

- 寫要執行的時候動畫開始

onAnimationRepeat() - Write you want to be performed when the animation repeats. 

onAnimationEnd(){ 

寫要在動畫結束

}