隨筆 - 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 小一敗涂地 閱讀(1901) 評論(0)  編輯  收藏 所屬分類: android+移動開發

          主站蜘蛛池模板: 开阳县| 麻江县| 凌源市| 西峡县| 肥东县| 新余市| 越西县| 彰化市| 龙岩市| 略阳县| 佛坪县| 涿州市| 阿拉善盟| 金寨县| 广昌县| 兴化市| 定南县| 佳木斯市| 安陆市| 雅江县| 东阳市| 兰坪| 雅安市| 兴国县| 喀喇沁旗| 个旧市| 都江堰市| 旬邑县| 晋江市| 泾阳县| 石阡县| 常熟市| 河东区| 东阿县| 民和| 三门县| 贵德县| 越西县| 当雄县| 岚皋县| 抚宁县|