完成在Android的播放如何找到动画 [英] How to find animation is finished playing in android

查看:151
本文介绍了完成在Android的播放如何找到动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


下面是一个简单的code以动画的WebView屏幕。但问题是,在屏幕获得滚动前的动画采取place..but我需要申请动画当前屏幕...我怎么能解决这个问题?

这是我的一块code

 如果(e1.getX() -  e2.getX()> SWIPE_MIN_DISTANCE和放大器;&安培; Math.abs(velocityX)> SWIPE_THRESHOLD_VELOCITY){

     mWebView.startAnimation(AnimationUtils.loadAnimation(上下文,R.anim.page_slide_left_in));
     mWebView.startAnimation(AnimationUtils.loadAnimation(上下文,R.anim.page_slide_left_out));

    mWebView.scrollBy(mWebView.getWidth(),0);
}
 

解决方案

android.view.animation.Animation 类(由 AnimationUtils返回。 loadAnimation 有一个叫做嵌套接口 AnimationListener ,你可以用它来确定何时动画已完成。具体来说,你会有兴趣在实施<监听接口code> onAnimationEnd 方法。

当然,你也不得不叫 setAnimationListener 动画实例> loadAnimation 。


Here is a simple code to animate webview screen. But the problem is, the screen get scrolled before the animation take place..but i need apply animation for current screen... how can i solve this?

here is my piece of Code

if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {

     mWebView.startAnimation(AnimationUtils.loadAnimation(context, R.anim.page_slide_left_in));  
     mWebView.startAnimation(AnimationUtils.loadAnimation(context,R.anim.page_slide_left_out));

    mWebView.scrollBy(mWebView.getWidth(),0);
}

解决方案

The android.view.animation.Animation class (returned by AnimationUtils.loadAnimation has a nested interface called AnimationListener which you can use to determine when an animation has completed. Specifically, you'd be interested in implementing the onAnimationEnd method of the listener interface.

Obviously, you'd also have to call setAnimationListener on the Animation instance returned by loadAnimation.

这篇关于完成在Android的播放如何找到动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆