好久以前就申請了CSDN賬號,但是一直沒有寫東西,期間學習了很多知識,都沒有記錄下來,總會有遺忘,總想把這些東西都記錄下來,算是對自己學到的東西的一種整理,也是對學習道路的記錄,如果以後在IT的路上走得很遠的時候,再來看一眼稚嫩的自己寫下的東西,我想一定會有很多感慨。
也不知道怎麼排版,現在寫的東西,真正發佈出去會有什麼效果,會不會像大神們寫的那樣看起來很美觀。什麼都有第一次嘛,先試着看看再說!~
特別喜歡看代碼的內個排版,感覺好看極了。粘出來一段,看看什麼效果。
package com.my.myweather.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import com.my.myweather.R;
public class WelcomeActivity extends Activity{
private final long STOP_LENGTH = 2000;
public Handler handler = new Handler();
/**
* 1.去掉系統標題欄。
* 2.使用handler的postDelayed實現延時跳轉,2秒後跳轉到主活動。
* */
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.welcome_activity);
handler.postDelayed(new Runnable(){ //使用handler的postDelayed實現延時跳轉
@Override
public void run(){
Intent intent = new Intent(WelcomeActivity.this,WeatherActivity.class);
intent.putExtra("toUpdateWeather","1"); //傳遞1,代表更新天氣
startActivity(intent);
finish();
}
},STOP_LENGTH); //2秒後跳轉至應用主界面WeatherActivity
}
}
再發一張圖片測試一下效果。
就這些了吧。先用到這些東西,看下效果再說!~