今天做了一个登陆的界面,算是开始认真学习安卓的第一步吧,代码在下面,我会解释一些标签的意思(在代码里)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
<!--match_parent表示占用父容器全部空间-->
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
<!--这个weight设置成1,表示这个控件相对于其它控件的大小重要性,它将占有更多空间-->
android:layout_weight="1"
android:gravity="center">
<LinearLayout
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:layout_width="60dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/string_user"/>
<EditText
android:id="@+id/user"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/passport"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@+id/name">
<TextView
android:layout_width="60dp"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/string_passport"/>
<EditText
android:id="@+id/passport_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</RelativeLayout>
<TextView
android:id="@+id/sound_help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dip"
android:layout_marginLeft="15dip"
android:text="@string/text_fogotPassport"
android:layout_marginBottom="5dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/cancel"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/login_in"/>
</LinearLayout>
</LinearLayout>
