android - Delay animation with Transitions framework -
i trying delay transition using transitionmanager.begindelayedtransition()
support library.
i want use autotransition
make linearlayout
appearing/disappearing. animation works expected, except not delayed.
transitionmanager.begindelayedtransition(rootviewgroup, new autotransition().setstartdelay(1000)); linearlayout.setvisibility(view.visible);
the linearlayout
in hierarchy of rootviewgroup
of course.
i did testing, unfortunately not able make work. looks setstartdelay
works on changebounds
transition.
see following example (when set startdelay
on first
transition, delay won't work):
linearlayout = (linearlayout) findviewbyid(r.id.testlinearlayout); msceneroot = (viewgroup) findviewbyid(r.id.rootview); mstaggeredtransition = new transitionset(); transition first = new fade(fade.out); transition second = new changebounds(); transition third = new fade(fade.in); second.setstartdelay(1000).addtarget(linearlayout); mstaggeredtransition.setordering(ordering_sequential); mstaggeredtransition.addtransition(first).addtransition(second).addtransition(third); findviewbyid(r.id.testbutton).setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { linearlayout.setvisibility(view.gone); transitionmanager.begindelayedtransition(msceneroot, mstaggeredtransition); linearlayout.setvisibility(view.visible); relativelayout.layoutparams params = (relativelayout.layoutparams) linearlayout.getlayoutparams(); params.addrule(align_parent_end); linearlayout.setlayoutparams(params); } });
so suggest use this:
msceneroot.postdelayed(new runnable() { @override public void run() { transitionmanager.begindelayedtransition(rootviewgroup, new autotransition().setstartdelay(1000)); linearlayout.setvisibility(view.visible); } }, 1000);
Comments
Post a Comment