新手學習,請輕噴! 好多東西都不規範,請指導!android
import android.app.Activity;app
import android.content.Intent;ide
import android.os.Bundle;post
import android.os.Handler;學習
/**this
* spa
* @Description 應用起始頁.net
* @author wesleyxml
* @date 2015年1月23日 上午11:55:08ip
*
*/
public class WelcomeActivity extends Activity {
//延遲3秒
private static final long SPLASH_DELAY_MILLIS = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
new Handler().postDelayed(new Runnable() {
public void run() {
Home();
}
}, SPLASH_DELAY_MILLIS);
}
/**
* 進入主頁
*/
private void Home(){
Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
WelcomeActivity.this.startActivity(intent);
WelcomeActivity.this.finish();
}
}
配置文件:activity_welcome.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/welcome"
android:scaleType="fitCenter"
android:contentDescription="@string/welcome"/>
</RelativeLayout>