How to make the textview blinking

Goofy picture Goofy · Feb 15, 2012 · Viewed 79.9k times · Source

Guys i have a textview which i need it to be blinking please help me with it.

<TextView 
       android:id="@+id/usage"
       android:layout_marginTop="220dip"
       android:layout_marginLeft="45dip"
       android:layout_marginRight="15dip"
       android:typeface="serif"            
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="Google "
       android:textColor="#030900"/>

I want the google text to be blinking

Answer

SolArabehety picture SolArabehety · Aug 16, 2012

You can use this:

TextView myText = (TextView) findViewById(R.id.myText );

Animation anim = new AlphaAnimation(0.0f, 1.0f);
anim.setDuration(50); //You can manage the blinking time with this parameter
anim.setStartOffset(20);
anim.setRepeatMode(Animation.REVERSE);
anim.setRepeatCount(Animation.INFINITE);
myText.startAnimation(anim);

It's the same answer I gave in this post Blinking Text in android view

Hope this helps!