java - Animation listerener not called after fragment change -
have main activitiy containing fragment. fragment can changed selecting menu item.
when on first fragment, clicking menu button. side bar shown. after selecting menu item, fragment changes.
when click menu item on fragment, animation listeren not called instantly. first have scroll in direction before calles script. menu item in main activity, should mind if there different fragment, right?
slidein = animationutils.loadanimation(getapplicationcontext(), r.anim.slide_in); slidein.setanimationlistener(new animationlistener() { @override public void onanimationstart(animation animation) { isanimating = true; } @override public void onanimationend(animation animation) { animation = new translateanimation(0.0f, 0.0f, 0.0f, 0.0f); animation.setduration((long) 0.1f); menuview.startanimation(animation); viewgroup.marginlayoutparams p = (viewgroup.marginlayoutparams) menuview.getlayoutparams(); p.setmargins(0, 0, 0, 0); menuview.setlayoutparams(p); isanimating = false; } @override public void onanimationrepeat(animation animation) { } }); menuview.startanimation(slidein);
and fragment change:
trans = getsupportfragmentmanager().begintransaction(); trans.remove((fragment) globals.getinstance().getcurrentfragment()); trans.add(r.id.realtabcontent, fragmentname, "tag"); trans.commit();
so on different fragment, animation started scroll. above code in main activity
the view not drawn yet, started after input. anwser had invalidate() root layout.
credits go jul
animation starts after i've touched screen
Comments
Post a Comment