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);
}
You can use the view animation system to perform tweened animation on Views. Tween animation calculates the animation with information such as the start point, end point, size, rotation, and other common aspects of an animation.
Open Settings . Scroll down and select Accessibility. Scroll down to Display and tap Text and display. Tap the toggle switch for Remove animations to turn it on.
Animations can add visual cues that notify users about what's going on in your app. They are especially useful when the UI changes state, such as when new content loads or new actions become available. Animations also add a polished look to your app, which gives it a higher quality look and feel.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With