我们要实现的页面跳转如下图所示:
第一个页面:
这个页面非常简单,我们可以直接把图片设为第一个页面的背景图片
通过等待3s之后跳转到第二个页面:
填写信息之后通过点击确定按钮跳转到第三个页面:
本页面为文本框输出上一页面所填写的内容
第一个页面代码(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"
//将图片设为背景图片
android:background="@drawable/wx"
tools:context=".MainActivity" >
</LinearLayout>
第一个页面的Java代码:主要实现效果为在第一个代码页面等待3秒跳转到第二个页面
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// 开启一个子线程
Thread t = new Thread(new Runnable() {
@Override
public void run() {
// 等待3s
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// 启动第二个页面
Intent it = new Intent(getApplicationContext(),
SecondActivity.class);
startActivity(it);
}
});
t.start();
}
}
第二个页面 代码(Activity代码)
此页面为用户注册的页面
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#3a4547" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="用户注册"
android:textColor="#fff" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
>
<TextView
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"