Android implementation of font flashing animation method _android

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.