Android: Animation Position Resets After Complete -


i'm using xml defined animation slide view off screen. problem is, animation completes resets original position. need know how fix this. here's xml:

<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">    <translate android:fromxdelta="0" android:toxdelta="-100%p" android:duration="500"/></set> 

here's java use call it:

    homescrn = (view)findviewbyid(r.id.homescreen);     slideleftout = animationutils.loadanimation(this, r.anim.slide_left_out);      //set click listeners menu     btnhelp.setonclicklistener(new onclicklistener() {         public void onclick(view v) {             layoutinflater.from(getapplicationcontext()).inflate(r.layout.help, (viewgroup)findviewbyid(r.id.subpage), true);             homescrn.startanimation(slideleftout);         }     }); 

so happens inflate view underneath one. animate view on top off left. gets off screen , animation finished resets position back.

the animations working expected. because animated not mean moved it. animation affects drawn pixels during animation itself, not configuration of widgets.

you need add animationlistener, , in onanimationend() method, makes move permanent (e.g., removes view on top parent, marks view on top having visibility gone).


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -