Android实现启动画面

来源:互联网 发布:linux c 系统启动时间 编辑:程序博客网 时间:2024/04/29 22:04

为后台准备资源做准备

XML布局文件:

<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>


Activity:

    @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();        }            }


摘自:http://www.cnblogs.com/dawei/archive/2010/04/29/1724044.html

原创粉丝点击