开发者

How to find animation is finished playing in android

开发者 https://www.devze.com 2023-03-03 16:58 出处:网络
Here is a simple code toanimate 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 s

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

精彩评论

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