main.xml
[code="java"]
<?xml version="1.0" encoding="utf-8"?>
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
android:id="@+id/passwordlab"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="@string/passwordlab"
/>
android:id="@+id/password"
android:layout_width="150px"
android:layout_height="50px"
android:layout_toRightOf="@id/passwordlab"
android:layout_marginRight="50px"
android:layout_alignTop="@id/password"
/>
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
android:id="@+id/usernamelab"
android:text="@string/usernamelab"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:id="@+id/username"
android:layout_width="150px"
android:layout_height="30px"
android:layout_toRightOf="@id/usernamelab"
android:layout_alignTop="@id/usernamelab"
android:layout_marginRight="20px"
/>
</RelativeLayout>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/set"
android:id="@+id/setbutton"
/>
[/code]
string.xml
[code="java"]
<?xml version="1.0" encoding="utf-8"?>
SharedPreference
用戶名
密碼
保存按鈕
[/code]
显示效果如下图: