Android欢迎界面

时间:2014-05-13 22:35:50   收藏:0   阅读:462
package edu.hpu.init;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import edu.hpu.logic.R;
import edu.hpu.viewpager.MyViewPagerActivity;
public class StartActivity extends Activity {
	//延迟1秒 
    private static final long delayTime = 1000;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        // 使用Handler的postDelayed方法,3秒后执行跳转 
        new Handler().postDelayed(new Runnable() {
        	//必须加上StartActivity,否则默认是该Runable接口
            public void run() {
            	goHome();
            }
        }, delayTime);
        
    }
    private void goHome() {
		Intent intent = new Intent(this, MyViewPagerActivity.class);
		startActivity(intent);
		this.finish();
	}
}

<!-- 欢迎界面 -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".StartActivity" >
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:background="@drawable/logo"
        android:scaleType="centerCrop" />
</RelativeLayout>

Android欢迎界面,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!