Android: remove a TextView after an animation -
in app add textview programmatically , after animation (traslate+alpha) in way
textview point = new textview(getapplicationcontext()); //... option textview animation anim = animationutils.loadanimation(getapplicationcontext(), r.anim.move_result_point); anim.setanimationlistener(this); point.startanimation(anim);
my xml animation is
<set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator" android:fillafter="true"> <translate android:fromydelta="0%p" android:toydelta="-50%p" android:duration="700" /> <alpha android:fromalpha="1" android:toalpha="0" android:duration="700"/> </set>
the want remove textview generated when animation finish, know can in
@override public void onanimationend(animation arg0) { }
but how can recognize exact textview generated in other method? can generated many textview in layout... can me?
thanks
how this?
public class viewanimationlistener implements animationlistener { view view; public void setview(view view) { this.view = view; } public void onanimationend(animation animation) { // whatever want view } public void onanimationrepeat(animation animation) { } public void onanimationstart(animation animation) { } }
so when want animate textview:
viewanimationlistener listener = new viewanimationlistener(); listener.setview(point); animation anim = animationutils.loadanimation(getapplicationcontext(), r.anim.move_result_point); anim.setanimationlistener(listener); point.startanimation(anim);
Comments
Post a Comment