Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> Android開發 >> 關於android開發 >> Android開發啟動畫面

Android開發啟動畫面

編輯:關於android開發

  應用啟動的時候,一般會有一個歡迎界面,是如何實現的呢?其實很簡單:

  public class WelComeActivity extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.welcome);
          Start();
      }
   
      public void Start() {
                  new Thread() {
                          public void run() {
                                  try {
                                          Thread.sleep(2500);
                                  } catch (InterruptedException e) {
                                          e.printStackTrace();
                                  }
                                  Intent intent = new Intent();
                                  intent.setClass(WelComeActivity.this, LoginActivity.class);
                                  startActivity(intent);
                                  finish();
                          }
                  }.start();
          }
  }

  布局文件:
  <?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="@drawable/logo"
      >
  </LinearLayout>

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved