首先打开ADT程序
创建文件如图:
命名Day06
创建好src和Layout布局
我们要实现的页面跳转如下所示:
第一个页面的背景图片
等待3秒之后跳转到第二个页面
填写个人信息之后点击确定按钮跳转到第三个页面
本页面为文本框输出上一页所填写的内容
第一个页面代码(Activity代码)
背景页面
<LinearLayout 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=".InfoActivity" >
//将图片设为背景图片
android:id="@+id/wx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
第一个页面代码(Java代码)
第一个代码页面等待3秒跳转到第二个页面
package com.example.day06;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class TwoActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//开启一个线程(等待3秒之后自动执行)
Thread t = new Thread(new Runnable() {
@Override
public void run() {
//等待3秒
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//启动第二个页面
Intent it = new Intent(getApplicationContext(),
MainActivity.class);
startActivity(it);
}
});
t.start();
}
}
第二个页面代码(Activity代码)
用户注册的页面
<LinearLayout xmlns:android="