【Android开发笔记】Android Splash Screen 启动界面

 1 public class SplashActivity extends Activity {
 2 
 3     @Override
 4     protected void onCreate(Bundle savedInstanceState) {
 5         super.onCreate(savedInstanceState);
 6 
 7         // 去掉标题栏
 8         // 必须在setContentView之前调用
 9         this.requestWindowFeature(Window.FEATURE_NO_TITLE);
10 
11         setContentView(R.layout.activity_loading);
12 
13         Handler handler = new Handler();
14         handler.postDelayed(new splashRunnable(), 3000);
15     }
16 
17     public class splashRunnable implements Runnable {
18 
19         @Override
20         public void run() {
21             //打开新Activity
22             startActivity(new Intent(getApplication(), MainActivity.class));
23             //关闭本Activity
24             LoadingActivity.this.finish();
25         }
26     }
27 }

 

你可能感兴趣的:(Android开发)