隨筆 - 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+移動開發

          主站蜘蛛池模板: 平阳县| 马尔康县| 唐海县| 平利县| 林甸县| 临桂县| 通州市| 章丘市| 长海县| 七台河市| 喜德县| 嘉义市| 桂平市| 平昌县| 南部县| 贡嘎县| 北票市| 安泽县| 石台县| 湖南省| 称多县| 资中县| 常德市| 朝阳市| 澜沧| 神池县| 喀什市| 开远市| 长汀县| 新安县| 同心县| 广南县| 铁力市| 中方县| 南平市| 新邵县| 临夏县| 梁山县| 麻栗坡县| 邳州市| 宣威市|