Today for a system to the left of the menu bar set a click event, set the translateanimation later found, when the displacement animation, the menu button's onclick event is still in, have to sigh that this official is really enough brain residue, So I added a control to the view of the hidden code, the final code is this:
Private voidstarthideanimation () {if(isexpand==true) {Animation hideanimation=NewTranslateanimation (0,-menulayoutwidth, 0, 0); Hideanimation.setinterpolator (Newacceleratedecelerateinterpolator ()); Hideanimation.setduration (800); Hideanimation.setfillafter (true); Hideanimation.setanimationlistener (NewAnimationlistener () {@Override Public voidOnanimationstart (Animation Animation) {//TODO auto-generated Method Stub} @Override Public voidonanimationrepeat (Animation Animation) {//TODO auto-generated Method Stub} @Override Public voidonanimationend (Animation Animation) {//TODO auto-generated Method Stub menulayout.setvisibility (view.gone); } }); Menulayout.startanimation (hideanimation);//directly set, Menulayout, although from the field of view disappears, but the effect of in-situ click is still} Isexpand=false; } Private voidstartshowanimation () {if(isexpand==false) {Animation showanimation=NewTranslateanimation (-menulayoutwidth, 0, 0, 0); Showanimation.setinterpolator (Newacceleratedecelerateinterpolator ()); Showanimation.setduration (500); Showanimation.setfillafter (true); Menulayout.startanimation (showanimation); menulayout.setvisibility (view.visible); } Isexpand=true; }
Android shift animation moved in situ after the Click event is still in