1

I want to do an infinite animation on my textview. But it doesnt work! This is my animation xml

<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" /> 

and this is my code in my activity

void animation(){ Animation anim1 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.animationtext); tviPrueba.startAnimation(anim1); anim1.setRepeatCount(Animation.INFINITE); } 
1
  • you probably need to set the setRepeatCount() before setting the animation to the TextView. Commented Sep 22, 2015 at 18:21

2 Answers 2

3

Don't complicate yourself... if is infinite, use the reverse mode:

<?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> 

remove the anim1.setRepeatCount(Animation.INFINITE); line and use my xml

Sign up to request clarification or add additional context in comments.

1 Comment

no problem :) remember to accept my answer so everyone can find it.
0
Animation anim1 = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.animationtext); anim1.setRepeatCount(Animation.INFINITE); tviPrueba.startAnimation(anim1); 

Comments