android练习:登录界面

今天做了一个登陆的界面,算是开始认真学习安卓的第一步吧,代码在下面,我会解释一些标签的意思(在代码里)
<?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"
    <!--gravity表示重力的方向,center就是中心-->
    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>

界面如图所示

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值