2013-10-01 54 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(){ 

写要在动画结束

}