textview上的Android动画
我想在我的文本视图上做一个无限动画。但是它不起作用!这是我的动画xmltextview上的Android动画,android,animation,Android,Animation,我想在我的文本视图上做一个无限动画。但是它不起作用!这是我的动画xml <alpha android:duration="1000" android:fromAlpha="0.0" android:interpolator="@android:anim/accelerate_interpolator" android:toAlpha="1.0" /> <alpha android:startOffset="1000" andro
<alpha
android:duration="1000"
android:fromAlpha="0.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:toAlpha="1.0" />
<alpha
android:startOffset="1000"
android:duration="1000"
android:fromAlpha="1.0"
android:interpolator="@android:anim/accelerate_interpolator"
android:toAlpha="0.0" />
不要把你自己复杂化。。。如果为无穷大,请使用反向模式:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="1000"
android:repeatMode="reverse"
android:repeatCount="infinite" />
</set>
删除
anim1.setRepeatCount(Animation.INFINITE)代码>行并使用我的xml在将动画设置为文本视图之前,您可能需要设置setRepeatCount()
。没问题:)记住接受我的答案,以便每个人都能找到它。
Animation anim1 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.animationtext);
anim1.setRepeatCount(Animation.INFINITE);
tviPrueba.startAnimation(anim1);
Animation anim1 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.animationtext);
anim1.setRepeatCount(Animation.INFINITE);
tviPrueba.startAnimation(anim1);