Android animation ends quickly -
i having following problem: have animation in android app moves ui elements @ screen, i.e. translate animation, works fine. let moving position (0,0) (0, 200) in screen. problem is, happens (like 0.001 seconds) , program loaded, not see movement of object see @ final position(0,200). here code:
handler handler = new handler(); float height; private relativelayout relativelayoutdoughnutandlogotogether; private relativelayout logo_donut_together2; private imageview imgsplash, image2; private doughnutview doughnutview; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); relativelayoutdoughnutandlogotogether = (relativelayout) findviewbyid(r.id.logo_donut_together); logo_donut_together2 = (relativelayout) findviewbyid(r.id.logo_donut_together2); imgsplash = (imageview) findviewbyid(r.id.turkcell_logo); image2 = (imageview) findviewbyid(r.id.imageview02); int logoheight = imgsplash.getdrawable().getintrinsicheight(); int screenheight = getwindowmanager().getdefaultdisplay().getheight(); final int centerscreen = (screenheight-logoheight)/2; doughnutview = new doughnutview(this) { @override public void onanimationcomplete() { float density = getresources().getdisplaymetrics().density; animation movetotop = new translateanimation(0, 0, centerscreen-50*density, 0); movetotop.setduration(1000); relativelayoutdoughnutandlogotogether.startanimation(movetotop); logo_donut_together2.setvisibility(view.gone); logo_donut_together2.removeview(doughnutview); relativelayoutdoughnutandlogotogether.addview(doughnutview); relativelayoutdoughnutandlogotogether.setvisibility(0); } }; doughnutview.setstartangle(0); doughnutview.setcolorfront(color.rgb(232, 232, 232)); doughnutview.setsweepangle(360); doughnutview.setstrokewidth(4); doughnutview.setmarginall(10); doughnutview.setcolorback(color.rgb(63, 176, 232)); doughnutview.startanimation(0); logo_donut_together2.addview(doughnutview); }
i talking onanimationcomplete part of code. appreciate if help.
thanks
you have write logic on onanimatinend(animation animation){...} may helps you...
relativelayoutdoughnutandlogotogether.setanimationlistener(new animation.animationlistener() { @override public void onanimationstart(animation animation) { } @override public void onanimationend(animation animation) { logo_donut_together2.setvisibility(view.gone); logo_donut_together2.removeview(doughnutview); relativelayoutdoughnutandlogotogether.addview(doughnutview); relativelayoutdoughnutandlogotogether.setvisibility(0); } @override public void onanimationrepeat(animation animation) { } });
Comments
Post a Comment