This article is an example of how Android implements font flicker animation. Share to everyone for your reference. Specifically as follows:
This is based on the thread and timer to achieve the Android font flashing animation effect.
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);//Get page TextView object
Timer timer = new timer ();
TimerTask taskcc = new TimerTask () {public
void run () {
runonuithread, new Runnable () {public
void run () { C14/>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);
Parameters are delay (how long after execution), duration (execution interval)
}
}
I hope this article will help you with your Android program.