I am confused with a problem:
Animation animation = new TranslateAnimation(0, 0, 200, 0);
animation.setDuration(800);
animation.setFillAfter(true);
btnView.startAnimation(animation);
btnView.setVisibility(View.VISIBLE);
I run this code work right but when I add the below code:
btnView.clearAnimation();
The animation can't show, how to clear animation after this?
On the slide, select the animation effect that you want to change. On the Animations tab, under Animation Options, click Effect Options, and then click Reverse Path Direction. Tip: To preview all animation effects on the slide, on the Animations tab, under Preview, click Play.
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.
To get rid of all the animations on a slide, it's easiest to select all the objects on the slide by pressing Ctrl+A. Then you can select the “None” option on the “Animations” tab to remove all the animations from the slide. Repeat this process for each slide in the presentation, and you'll be animation free in no time.
if you want to clear the animations for the view once the animations i finished
you have to override Animation Listener of view and then clear the animation
if you want your view to move back to intial postion just setFillafter(false);
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
// TODO set params of the view to required position
}
});
To clear animation after it is finished set setFillAfter to false.
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