ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

个人冲刺(一)——体温上报app(二阶段)

2021-06-10 21:02:10  阅读:200  来源: 互联网

标签:xml app register 冲刺 体温 activity login


冲刺任务:完成app登录和注册页面的布局

activity_register.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".RegisterActivity"
    android:background="#eeeeee"
    >
    <RelativeLayout
        android:id="@+id/rl_registeractivity_top"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:background="@color/color_minefragment_top"
        >
        <ImageView
            android:id="@+id/iv_registeractivity_back"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:background="@drawable/ic_left_back"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:clickable="true"
            android:onClick="onClick"
            />

        <TextView
            android:id="@+id/tv_registeractivity_register"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="注册"
            android:textColor="#fff"
            android:textSize="20dp"
            android:layout_toRightOf="@+id/iv_registeractivity_back"
            android:layout_centerVertical="true"
            android:layout_marginLeft="20dp"
            />
    </RelativeLayout>

    <LinearLayout
        android:id="@+id/ll_registeractivity_body"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_below="@+id/rl_registeractivity_top"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        >
        <!--
        具体内容部分
        -->
        <LinearLayout
            android:id="@+id/ll_loginactivity_two"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_below="@+id/rl_registeractivity_top"
            android:layout_marginTop="10dp"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
                <EditText
                    android:id="@+id/et_registeractivity_name"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="姓名"/>
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <EditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/et_registeractivity_id"
                    android:hint="学号"></EditText>
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
                <EditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/et_registeractivity_address"
                    android:hint="班级"></EditText>
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
                <EditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/et_registeractivity_phone"
                    android:hint="手机号码"></EditText>
            </LinearLayout>

        </LinearLayout>
        <!-- 验证码部分 -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginRight="15dp"
            android:layout_marginTop="10dp"
            android:orientation="horizontal" >
            <!-- 第四个文本编辑框  输入验证码 -->
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">
                <TextView
                    android:id="@+id/tv_registeractivity_phoneCodes"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginRight="15dp"
                    android:text="验证码:"/>
                <EditText
                    android:id="@+id/et_registeractivity_phoneCodes"
                    android:layout_width="0dp"
                    android:layout_weight="3"
                    android:layout_height="50dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:hint="请输入4位验证码" />

                <ImageView
                    android:id="@+id/iv_registeractivity_showCode"
                    android:layout_width="0dp"
                    android:layout_height="70dp"
                    android:layout_weight="1.5"
                    android:clickable="true"
                    android:onClick="onClick"
                    android:layout_marginTop="-10dp"
                    />
            </LinearLayout>
        </LinearLayout>
        <!-- 注册按钮 -->
        <Button
            android:id="@+id/bt_registeractivity_register"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginLeft="5dp"
            android:background="@drawable/selector_loginactivity_button"
            android:textColor="#fff"
            android:text="注册"
            android:onClick="onClick"
            android:layout_marginTop="40dp"
            />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:id="@+id/rl_registeractivity_bottom"
            android:layout_marginTop="10dp"
            >
            <TextView
                android:layout_centerInParent="true"
                android:text="注册即代表同意《用户协议》"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"/>
        </RelativeLayout>

    </LinearLayout>

</RelativeLayout>

activity_login.xml

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#eeeeee"
    tools:context=".loginActivity">
    <!--
    整体是相对布局,
    在整体上方放三个东西,这三个东西也是相对布局
    合在一起称为一个top
    一个返回箭头   ←
    两个文字显示   登录  注册
    也就是说   login界面的上方长这个样子
          ←   登录       注册
    下面是具体代码
    -->
    <RelativeLayout
        android:id="@+id/rl_loginactivity_top"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:background="@color/color_minefragment_top" >
        <ImageView
            android:id="@+id/iv_loginactivity_back"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:background="@drawable/ic_left_back"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:clickable="true"
            android:onClick="onClick"
            />

        <TextView
            android:id="@+id/tv_loginactivity_login"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="登录"
            android:textColor="#fff"
            android:textSize="20dp"
            android:layout_toRightOf="@+id/iv_loginactivity_back"
            android:layout_centerVertical="true"
            android:layout_marginLeft="20dp"
            />
        <TextView
            android:id="@+id/tv_loginactivity_register"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="注册"
            android:textColor="#fff"
            android:textSize="20dp"
            android:layout_centerVertical="true"
            android:layout_alignParentRight="true"
            android:layout_marginRight="30dp"
            android:clickable="true"
            android:onClick="onClick"
            />
    </RelativeLayout>
    <LinearLayout
        android:id="@+id/ll_loginactivity_two"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_below="@+id/rl_loginactivity_top"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/tv_loginactivity_phone"
                android:text="手机号码"
                android:layout_marginRight="20dp"
                ></TextView>
            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/et_loginactivity_phone"
                android:hint="输入手机号码"></EditText>
        </LinearLayout>
    </LinearLayout>
    <!--
      注意最后有一句: android:onClick="onClick"
      这是应用了一个开源库,详细信息在loginActivity.java 中有注释
      -->
    <Button
        android:id="@+id/bt_loginactivity_login"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/ll_loginactivity_two"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:background="@drawable/selector_loginactivity_button"
        android:text="登录"
        android:textColor="#fff"
        android:gravity="center"
        android:onClick="onClick"
        />
    <!--
        为了App的人性化,
        想到有以下三种无法密码登录的异常处理情况
        一、密码错误,重新输入
        二、忘记密码,重新修改密码
        三、不想注册,通过短信验证登录
        密码输错了,重新输入,这个没啥说的
        忘记密码应该以一个可以点击的文字出现在登录按钮的左下方
        短信验证登录也以一个可以点击的文字出现在登录按钮的右下方
    -->

</RelativeLayout>

 

标签:xml,app,register,冲刺,体温,activity,login
来源: https://www.cnblogs.com/zyj3955/p/14872773.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有