android小知识之SplashActivity(欢迎界面)

 这是我做的SplashActivity,用于项目的启动界面,布局文件尽量简单明了,不累赘,简明大方。

 1 package com.chrizz.ui;
 2 
 3 import android.app.Activity;
 4 import android.content.Intent;
 5 import android.os.Bundle;
 6 import android.os.Handler;
 7 import android.view.Window;
 8 import android.view.WindowManager;
 9 
10 /**
11  * 类名称: SplashActivity
12  * 功能描述:开始欢迎界面
13  * 作者: ws
14  * 创建日期: 2013-12-3 上午10:20:18
15  *
16  */
17 public class SplashActivity extends Activity {
18     
19     @Override
20     protected void onCreate(Bundle savedInstanceState) {
21         super.onCreate(savedInstanceState);
22         // 设置为全屏幕显示
23         getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
24                 WindowManager.LayoutParams.FLAG_FULLSCREEN);
25         requestWindowFeature(Window.FEATURE_NO_TITLE);
26         setContentView(R.layout.splash);
27         this.startFrame();
28     }
29     
30     /**
31      * 启动欢迎界面并设置显示时间为2秒
32      */
33     public void startFrame(){
34         new Handler().postDelayed(new Runnable() {
35             @Override
36             public void run() {
37                 Intent intent = new Intent("com.chrizz.ui.LoginActivity");
38                 startActivity(intent);
39                 SplashActivity.this.finish();
40             }
41         }, 1000);
42     }
43 }
SplashActivity

这篇博文也的非常好,做个记录:http://www.cnblogs.com/qianxudetianxia/archive/2012/12/30/2839700.html

posted @ 2013-12-03 16:08  寡蛋  阅读(552)  评论(0编辑  收藏  举报