[Android开发笔记]-----闪动字体

 

  
  
  
  
  1. /** 
  2.      * 设置字体闪动效果 
  3.      * 
  4.      */ 
  5.     public void spark() {   
  6.         final TextView TextView01 = (TextView) findViewById(R.id.TextView01);// 获取页面textview对象   
  7.         Timer timer = new Timer();   
  8.         TimerTask taskcc = new TimerTask(){   
  9.    
  10.             public void run() {   
  11.                 runOnUiThread(new Runnable() {   
  12.                     public void run() {   
  13.                         if (clo == 0) {   
  14.                             clo = 1;   
  15.                             TextView01.setTextColor(Color.TRANSPARENT); // 透明   
  16.                         } else {   
  17.                             if (clo == 1) {   
  18.                                 clo = 2;   
  19.                                 TextView01.setTextColor(Color.WHITE);   
  20.                             } else {   
  21.                                 clo = 0;   
  22.                                 TextView01.setTextColor(Color.WHITE);   
  23.                             }   
  24.                         }   
  25.                     }   
  26.                 });   
  27.             }   
  28.         };   
  29.         timer.schedule(taskcc, 11000); // 参数分别是delay(多长时间后执行),duration(执行间隔)   
  30.     }   
  31.      

 

你可能感兴趣的:(android,开发,职场,休闲)