以登录为例,假设有一个界面为登录界面,另一个为登录成功后跳转的页面
----------登陆界面---------------- -------------登陆成功后跳转的页面--------------用户名的输入框(editText组件) 欢迎你,XXX用户密码的输入框(editText组件)
登录按钮(button组件)------------------------------------ -------------------------------------------------------页面的布局代码如下:----------登陆界面----------------
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/logintitle"
- android:textSize="24sp"
- />
- <editText
- android:id="@+id/username"
- android:layout_width="fill_parent"
- android:layout_height="match_parent"
- android:hint="@string/nametip" 请输入用户名
- />
- <editText
- android:id="@+id/password"
- android:layout_width="fill_parent"
- android:layout_height="match_parent"
- android:hint="@string/pwdtip" 请输入密码
- android:password="true"
- />
- <Button
- android:id="@+id/loginbutton"
- android:layout_width="fill_parent"
- android:layout_height="match_parent"
- android:text="@string/loginbutton"
- />
-
- </LinearLayout>
-------------登陆成功后跳转的页面--------------
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <TextView
- android:id="@+id/result"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/result"
- android:textSize="24sp"
- />
-
- <Button
- android:id="@+id/loginbutton"
- android:layout_width="fill_parent"
- android:layout_height="match_parent"
- android:text="@string/jumpbutton" 跳转
- />
-
- </LinearLayout>