开发者

How to find animation is finished playing in android

Here is a simple code to animate webview screen. But the problem is, the screen get scrolled before the animation take place..开发者_如何学Gobut 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜