How to Implement font flashing animation in android
This article describes how to implement font blinking animation in android. Share it with you for your reference. The details are as follows:
Here, the font flashing animation effect for Android is implemented based on the thread and Timer.
?
Public class ActivityMain extends Activity {
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. main );
Spark ();
}
Private int clo = 0;
Public void spark (){
Final TextView touchScreen = (TextView) findViewById (R. id. TextView01); // obtain the page textview object
Timer timer = new Timer ();
TimerTask taskcc = new TimerTask (){
Public void run (){
RunOnUiThread (new Runnable (){
Public void run (){
If (clo = 0 ){
Clo = 1;
TouchScreen. setTextColor (Color. TRANSPARENT); // TRANSPARENT
} Else {
If (clo = 1 ){
Clo = 2;
TouchScreen. setTextColor (Color. RED );
} Else {
Clo = 0;
TouchScreen. setTextColor (Color. GREEN );
}
}
}
});
}
};
Timer. schedule (taskcc, 1,300 );
// The parameters are delay (after how long) and duration (Execution interval)
}
}
I hope this article will help you design your Android program.