一,第一个背景页面
1.创建第一个页面MainActivity

2.代码如下
<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/ic_launcher"
tools:context=".MainActivity" ></LinearLayout>
二、第一个背景页面跳转到第二个页面
1.创建第二个页面InfoActivity

2.第二个页面背景
<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:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="55dp" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#3b4141"
android:gravity="center"
android:text="用户注册"
android:textColor="#ffffff"
android:textSize="20dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp" >
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center|right"
android:text="账号:"
android:textSize="15dp" />
<EditText
android:id="@+id/et_zh"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_weight="3"
android:background="@drawable/bk_border"
android:hint="请输入QQ号/手机号" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp" >
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center|right"
android:text="密码:"
android:textSize="15dp" />
<EditText
android:id="@+id/et_mm"
&nbs

这篇博客详细介绍了如何在Android中实现页面间的跳转。从创建第一个页面MainActivity开始,通过XML布局设计,然后演示了如何从第一个页面跳转到第二个页面InfoActivity,并在第二个页面中进行用户注册信息的输入,包括账号、密码、班级、性别和爱好。接着,讲解了如何从第二个页面跳转到第三个页面TestActivity,展示传递的数据。最后,展示了完整的页面跳转代码实现。
最低0.47元/天 解锁文章
751

被折叠的 条评论
为什么被折叠?



