我是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);
}
我想问一下,如何更改每个动画重复的文字?
答案 0 :(得分:2)
通过AnimationListener
注册setAnimationListener()
,并在听众的onAnimationRepeat()
方法中更改文字。