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:
make sure
setfillafter
flag on animation setfalse
. there's no needanimationlistener
once animation ends, call
view.setanimation(null);
hope helps :)
Comments
Post a Comment