Playing with animation in android -
i learning android animation , thought of playing it. have created animation want there should delay/wait between animation.
here code.
new animationutils(); animation anim = animationutils.loadanimation(this, r.anim.abc_slide_in_bottom); findviewbyid(r.id.app_logo).startanimation(anim); findviewbyid(r.id.addtopic).startanimation(anim); findviewbyid(r.id.adddescription).startanimation(anim); findviewbyid(r.id.addbtn).startanimation(anim);
now want after findviewbyid(r.id.app_logo).startanimation(anim);
should wait animation finish. once finished findviewbyid(r.id.addtopic).startanimation(anim);
should start , on.
if can guide me on how achieve happy thankful
thanks.
this simple solution needs:
final animation anim0 = animationutils.loadanimation(this, r.anim.abc_slide_in_bottom); final animation anim1 = animationutils.loadanimation(this, r.anim.abc_slide_in_bottom); final animation anim2 = animationutils.loadanimation(this, r.anim.abc_slide_in_bottom); final animation anim3 = animationutils.loadanimation(this, r.anim.abc_slide_in_bottom); animation.animationlistener animationlistener = new animation.animationlistener() { int count = 0; @override public void onanimationstart(animation animation) { } @override public void onanimationend(animation animation) { switch (count){ case 0: findviewbyid(r.id.addtopic).setvisibility(view.visible); findviewbyid(r.id.addtopic).startanimation(anim1); break; case 1: findviewbyid(r.id.adddescription).setvisibility(view.visible); findviewbyid(r.id.adddescription).startanimation(anim2); break; case 2: findviewbyid(r.id.addbtn).setvisibility(view.visible); findviewbyid(r.id.addbtn).startanimation(anim3); break; } count++; } @override public void onanimationrepeat(animation animation) { } }; anim1.setanimationlistener(animationlistener); anim2.setanimationlistener(animationlistener); anim3.setanimationlistener(animationlistener); findviewbyid(r.id.app_logo).startanimation(anim0); findviewbyid(r.id.addtopic).setvisibility(view.gone); findviewbyid(r.id.adddescription).setvisibility(view.gone); findviewbyid(r.id.addbtn).setvisibility(view.gone);
Comments
Post a Comment