欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

android實(shí)現(xiàn)字體閃爍動(dòng)畫的方法

 更新時(shí)間:2015年07月14日 16:28:31   作者:鑒客  
這篇文章主要介紹了android實(shí)現(xiàn)字體閃爍動(dòng)畫的方法,涉及Android中線程調(diào)用和Timer計(jì)時(shí)器的使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了android實(shí)現(xiàn)字體閃爍動(dòng)畫的方法。分享給大家供大家參考。具體如下:

這里基于線程和Timer實(shí)現(xiàn)Android的字體閃爍動(dòng)畫效果。

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);// 獲取頁(yè)面textview對(duì)象
  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); // 透明
      } else {
       if (clo == 1) {
        clo = 2;
        touchScreen.setTextColor(Color.RED);
       } else {
        clo = 0;
        touchScreen.setTextColor(Color.GREEN);
       }
      }
     }
    });
   }
  };
  timer.schedule(taskcc, 1, 300);
  // 參數(shù)分別是delay(多長(zhǎng)時(shí)間后執(zhí)行),duration(執(zhí)行間隔)
 }
}

希望本文所述對(duì)大家的Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論