Android的RotateAnimation完成

Android的RotateAnimation完成

本文介绍了Android的RotateAnimation完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在工作的 RotateAnimation 我开始旋转图像,但我想,当动画完成。我怎样才能得到它呢?

下面是我的旋转图像code。

  RotateAnimation rotateanimation =新RotateAnimation(StartPoint可以,
                    端点Animation.RELATIVE_TO_SELF,0.5F,
                    Animation.RELATIVE_TO_SELF,0.5F);
            rotateanimation.setDuration(1000);
            rotateanimation.setRepeatCount(0);
            rotateanimation.setRepeatMode(Animation.REVERSE);
            rotateanimation.setFillAfter(真);
            rotateImage.setAnimation(rotateanimation);
            rotateanimation.start();
            relative.invalidate();


解决方案

 使用动画监听器:实现了活动的动画监听器
接着 :
* rotateanimation.setAnimationListener(MainActivity.this);
*后,你会发现在
    公共无效onAnimationEnd(动画动画)
{
//吐司在这里动画结束
}http://developer.android.com/reference/android/view/animation/Animation.AnimationListener.html

I am working on RotateAnimation I started rotate image but I want to get when animation complete. How can I get it?

Below is my rotation image code.

RotateAnimation rotateanimation = new RotateAnimation(StartPoint,
                    EndPoint, Animation.RELATIVE_TO_SELF, 0.5f,
                    Animation.RELATIVE_TO_SELF, 0.5f);
            rotateanimation.setDuration(1000);
            rotateanimation.setRepeatCount(0);
            rotateanimation.setRepeatMode(Animation.REVERSE);
            rotateanimation.setFillAfter(true);
            rotateImage.setAnimation(rotateanimation);
            rotateanimation.start();
            relative.invalidate();
解决方案
Use Animation Listener as:

implements animation listener in activity
and then :
*rotateanimation.setAnimationListener(MainActivity.this);
*after that you will find on
    public void onAnimationEnd(Animation animation)
{
//Toast here on animation ends
}

http://developer.android.com/reference/android/view/animation/Animation.AnimationListener.html

这篇关于Android的RotateAnimation完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 05:32