android - how to clear aftereffects of animation -


i have 2 views being animated sliding in , out of screen simultaniously

this code it: how animate slide in notification view pushes content view down

however, when animation slides in, must clear animation, in order click events work properly, otherwise translated (which not want)

what need put in onanimationend in listener in order clear animation , have view remain way looks after has been animated

this current code:

greenviewslidein(1500, 0, new animatorlistener() {                  @override                 public void onanimationstart(animator animation) {                     greenview.setvisibility(view.visible);                 }                  @override                 public void onanimationrepeat(animator animation) {                     // todo auto-generated method stub                  }                  @override                 public void onanimationend(animator animation) {                      framelayout.layoutparams layoutparams = new framelayout.layoutparams(blueview.getwidth(), blueview.getheight());                     layoutparams.setmargins(blueview.getleft(), blueview.gettop() - greenviewheight, blueview.getright(), blueview.getbottom());                     blueview.setlayoutparams(layoutparams);                     greenview.clearanimation(); //                  blueview.clearanimation();                  }                  @override                 public void onanimationcancel(animator animation) {                     // todo auto-generated method stub                  }             }); 

two things can do:

  1. make sure setfillafter flag on animation set false. there's no need animationlistener

  2. once animation ends, call view.setanimation(null);

hope helps :)


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -