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

          主站蜘蛛池模板: 孝感市| 原平市| 贵定县| 六盘水市| 溧水县| 嘉善县| 汶上县| 报价| 双桥区| 东乡族自治县| 新民市| 富蕴县| 聊城市| 乌鲁木齐县| 崇州市| 长治县| 杨浦区| 新野县| 衡南县| 醴陵市| 东平县| 红安县| 通化县| 乌审旗| 施甸县| 德阳市| 建湖县| 林甸县| 盐池县| 巫山县| 岳西县| 武夷山市| 枞阳县| 甘孜| 邵东县| 罗江县| 博湖县| 吴江市| 鹤山市| 永川市| 天等县|