編輯:關於Android編程
功能非常簡單就是定義一個CountDownTimer直接看代碼
首先在XML裡面放個按鈕代碼如下:

下面就是主代碼:
package com.example.countdowntimer;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.app.Activity;
import android.graphics.Color;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
private TimeCount time;
private Button btnGetcode;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
time = new TimeCount(60000, 1000);
btnGetcode=(Button) findViewById(R.id.btn_getcode);
btnGetcode.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
time.start();
}
});
}
class TimeCount extends CountDownTimer {
public TimeCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@Override
public void onTick(long millisUntilFinished) {
btnGetcode.setBackgroundColor(Color.parseColor(#B6B6D8));
btnGetcode.setClickable(false);
btnGetcode.setText(millisUntilFinished / 1000 + 秒後可重新發送);
}
@Override
public void onFinish() {
btnGetcode.setText(重新獲取驗證碼);
btnGetcode.setClickable(true);
btnGetcode.setBackgroundColor(Color.parseColor(#4EB84A));
}
}
}
Android 操作系統獲取Root權限 原理詳細解析
android root權限破解分析許多機友新購來的Android機器沒有破解過Root權限,無法使用一些需要高權限的軟件,以及進行一些高權限的操作,其實破解手機Root
android 在開發WebView時,去掉網頁的標題並設置成自定義的標題
IOS中關於去掉標題只需類似下面的兩行代碼[js appendString:@var title = document.getElementsByClassName(
Android底部導航欄—RadioButton+Fragment
簡單拓展RadioButton控件使用如果不看這些,就直接下托RadioButton和CheckBox的區別:1、單個RadioButton在選中後,通過點擊無法變為未選
android中生成excel
都說程序員不爽產品經理,其實有的時候遇到一些奇葩的後台開發人員也會很不順心。最近項目有這樣一個要求,要生成一個excel然後發郵件給客戶。結果後台人員直接把這個功能扔給客