亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Android啟動畫面的實現(xiàn)方法

 更新時間:2015年01月19日 14:39:10   投稿:shichen2014  
這篇文章主要介紹了Android啟動畫面的實現(xiàn)方法,分析了布局文件及加載啟動文件的實現(xiàn)方法,非常具有實用價值,需要的朋友可以參考下

本文實例講述了Android啟動畫面的實現(xiàn)方法。分享給大家供大家參考。具體分析如下:

在應(yīng)用程序中經(jīng)常用到啟動畫面,會啟動一個后臺線程為主程序的運行準(zhǔn)備資源。
Android要實現(xiàn)啟動畫面可以這樣做:

這是splash.xml布局文件的代碼:

復(fù)制代碼 代碼如下:
<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>

放一個ImageView加載啟動畫面圖片
SplashActivity作為主視圖啟動:

復(fù)制代碼 代碼如下:
/** 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();
        }
}

希望本文所述對大家的Android程序設(shè)計有所幫助。

相關(guān)文章

最新評論