2010-08-25 109 views
2

我是Android新手,嘗試翻譯動畫。在Android中翻譯動畫問題

這是我的XML代碼:(rail.xml

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

,這是我的Java代碼:

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); 
} 

我想請問,我該如何改變的文本每個動畫重複?

回答

2

通過setAnimationListener()註冊AnimationListener,並在偵聽器的onAnimationRepeat()方法中更改您的文本。

+0

非常感謝你,你的回答非常有幫助.. :) – Vootsugu 2010-08-25 07:00:52