隨筆 - 0, 文章 - 264, 評論 - 170, 引用 - 0
          數據加載中……

          Android啟動畫面實現(注:整理于http://www.devdiv.net/bbs/archiver/tid-33217.html)

          在應用程序中經常用到啟動畫面,會啟動一個后臺線程為主程序的運行準備資源。
          Android要實現啟動畫面可以這樣做:
          這是splash.xml布局文件的代碼[code]<LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical">
          <ImageView android:layout_height="fill_parent" android:layout_width="fill_parent" android:scaleType="fitCenter" android:src="@drawable/splash"></ImageView>
          </LinearLayout>[/code]

          放一個ImageView加載啟動畫面圖片
          SplashActivity作為主視圖啟動[code]/** Called when the activity is first created. */
              @Override
              public void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.splash);
                  Handler x = new Handler();
                  x.postDelayed(new splashhandler(), 2000);
                  
              }
              class splashhandler implements Runnable{

                  public void run() {
                      startActivity(new Intent(getApplication(),MainActivity.class));
                      SplashActivity.this.finish();
                  }
                  
              }[/code]

          posted on 2010-11-17 21:44 小一敗涂地 閱讀(1900) 評論(0)  編輯  收藏 所屬分類: android+移動開發

          主站蜘蛛池模板: 巫山县| 邵阳县| 沅陵县| 余江县| 扬州市| 静安区| 临潭县| 望谟县| 闽清县| 闻喜县| 柳州市| 阿克苏市| 安远县| 泸定县| 辉南县| 栖霞市| 临湘市| 黑水县| 思南县| 武清区| 鹿泉市| 隆林| 蕉岭县| 汝城县| 贺州市| 胶州市| 长沙县| 隆子县| 曲阳县| 北宁市| 乌兰浩特市| 崇仁县| 长兴县| 土默特左旗| 贺兰县| 兴和县| 尉氏县| 甘德县| 石台县| 延长县| 田林县|