views:

48

answers:

1

Hi!! I am new to android, I try to make translate animation..

this is my xml code: (rail.xml)

<translate
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:fromXDelta="100%p"
 android:toXDelta="0"
 android:duration="4000" />

and this is my java code:

final Animation animShow = AnimationUtils.loadAnimation( this, R.anim.rail);
for(int i = 1; i < 5; i++ ){

    animShow.setRepeatCount(i);

    textTV.setText("Hello Android!!");
    textTV.startAnimation(animShow);
}

I want to ask, how do I change the text of each animation repeat?? please help and thanks a lot...

+1  A: 

Register an AnimationListener via setAnimationListener(), and change your text in the listener's onAnimationRepeat() method.

CommonsWare
thank you very much, your answer very helpful.. :)
Vootsugu