作者:孙英鹏  撰写时间:2020年5月27日

如何设计出好看的页面,我们来看一下。

实现过程:

1.标题
首先建立LinearLayout线性布局,然后设计垂直和水平排列,然后居中,在里面建立一个TextView控件来写标题,设计字体大小和颜色。

2.图标
和上面一样,建立LinearLayout线性布局,然后居中,在里面放ImageView控件用来放图片。

3.布局输入框和按钮
先建立两个TextView控件,用来写手机号输入框和密码输入框和验证码输入框,关于密码输入框是在页面隐藏的,这里用到android:visibility=“gone”,这样就不用再重新写一个页面用来输入密码。

4.最后在建立两个TextView控件,是用来占空间的,把它们挤在中间好看一点。

代码:

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/colorWhite"><!--占位-->
<TextViewandroid:layout_width="wrap_content"android:layout_height="0dp"android:layout_weight="1"/><!--布局 酒店名字-->
<LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:orientation="horizontal"><!--酒店名字--><TextViewandroid:id="@+id/title"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="欢迎登陆"android:textSize="25sp"android:textColor="@color/colorPrimary"app:layout_constraintTop_toTopOf="parent"/></LinearLayout><!--布局 图标-->
<LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:orientation="horizontal"><!--图标--><ImageViewandroid:id="@+id/icon"android:layout_width="104dp"android:layout_height="104dp"app:srcCompat="@drawable/icon04"app:layout_constraintTop_toBottomOf="@id/title"/></LinearLayout><!--布局 输入框和按钮-->
<LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:paddingLeft="5dp"android:paddingRight="5dp"android:orientation="vertical"android:layout_marginTop="20dp"><!--手机号--><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><!--TextView 文本  手机号--><TextViewandroid:layout_width="70dp"android:layout_height="wrap_content"android:gravity="center"android:text="手机号:"/><!--EditText 文本输入框--><EditTextandroid:id="@+id/et_login_phone"android:layout_width="match_parent"android:layout_height="wrap_content"android:inputType="phone"android:maxLength="11"android:hint="请输入手机号"/></LinearLayout><!--验证码--><LinearLayoutandroid:id="@+id/ll_login_sms"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><TextViewandroid:layout_width="70dp"android:layout_height="wrap_content"android:gravity="center"android:maxLength="6"android:text="验证码:" /><!-- 去除前后的TextView的宽度,剩下宽度的 1/1 --><EditTextandroid:id="@+id/et_login_smsCode"android:layout_weight="1"android:layout_width="0dp"android:layout_height="wrap_content"android:inputType="number"android:hint="请输入短信验证码"/><TextViewandroid:id="@+id/tv_login_send_smsCode"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textColor="@color/colorPrimary"android:text="获取验证码" /></LinearLayout><!--密码--><LinearLayoutandroid:id="@+id/ll_login_password"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"android:visibility="gone"><!--TextView 文本  html的p标签--><TextViewandroid:layout_width="70dp"android:layout_height="wrap_content"android:gravity="center"android:text="密   码:"/><!--EditText 文本输入框  类似HTML input--><EditTextandroid:id="@+id/et_login_password"android:layout_width="match_parent"android:layout_height="wrap_content"android:inputType="textPassword"android:maxLength="8"android:hint="请输入密码"/></LinearLayout><!--登录按钮--><Buttonandroid:id="@+id/btn_login_submit"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_margin="10dp"android:background="@@color/colorPrimary"android:textColor="@color/colorWhite"android:textSize="22sp"android:text="登录"/><!--下面操作按钮 注册--><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:orientation="horizontal"android:layout_margin="20dp"><!--注册--><TextViewandroid:id="@+id/tv_login_register"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textColor="@color/colorGray"android:textSize="20dp"android:text="注册" /></LinearLayout><!--下面操作按钮 布局居中--><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:orientation="horizontal"android:layout_margin="10dp"><!--密码登录--><TextViewandroid:id="@+id/tv_login_password"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textColor="@color/colorPrimaryDark"android:text="密码登录" /><!--验证码登录--><TextViewandroid:id="@+id/tv_login_sms"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textColor="@color/colorPrimaryDark"android:visibility="gone"android:text="验证码登录" /><!--线--><Viewandroid:layout_width="1dp"android:layout_height="match_parent"android:layout_marginLeft="5dp"android:layout_marginRight="5dp"android:background="@color/colorPrimaryDark"/><!--重置密码--><TextViewandroid:id="@+id/tv_login_forget_password"android:layout_width="wrap_content"android:layout_height="wrap_content"android:textColor="@color/colorPrimaryDark"android:text="重置密码" /></LinearLayout></LinearLayout><!--占位-->
<TextViewandroid:layout_width="wrap_content"android:layout_height="0dp"android:layout_weight="1.5"/></LinearLayout>

Android-Studio的登录页面设计相关推荐

  1. Android studio自动登录和记住密码的实现

    Android studio自动登录和记住密码的实现 文章目录 Android studio自动登录和记住密码的实现 前言 一.效果 二.设计思路 三.知识点介绍 1. SharedPreferenc ...

  2. 基于Android studio的备忘录app设计

    系统使用Android studio开发平台开发,使用sqlite数据库进行数据存储. 功能如下: 注册登录 管理备忘信息(增删查改) 根据备忘录创建时间快速查询 基于Android studio的备 ...

  3. 测试篇(三):测试用例的万能公式、对水杯和登录页面设计测试用例、测试用例的设计方法

    目录 一.测试用例的万能公式 二.对登录页面设计测试用例 三.测试用例的设计方法 3.1 基于需求的设计方法 3.2 等价类 3.3 边界值 3.4 判定表 3.5 正交排列 3.6 场景设计法 3. ...

  4. HTML登录页面设计

    HTML登录页面设计 编写用户登录页面,效果如下所示: 代码如下: <!DOCTYPE html> <html lang="en"> <head> ...

  5. Python 程序设计-系统登录页面设计

    Python 程序设计-系统登录页面设计 目录 Python 程序设计-系统登录页面设计 1.需求分析 2.总体设计 3.详细设计 4.程序运行结果测试与分析 5.完整源代码 1.需求分析 系统要有管 ...

  6. Java学习day3——Javaweb登录页面设计(1)(含JSP代码)

    写在前面 本文主要的内容是完成网页登录页面设计,以及判断用户名密码是否正确,如果正确,进入下一页面,并输出sessionID,若错误,则在登录页面给出用户名或密码错误提示,并在登录页面显示访问次数. ...

  7. 页面学习——鸿蒙登录页面设计

    页面学习--鸿蒙登录页面设计 1.布局文件 <?xml version="1.0" encoding="utf-8"?> <Direction ...

  8. APP开发流程实例讲解-儒释道网络电台八天开发全程-在Android Studio中完成界面设计

    APP开发流程实例讲解-儒释道网络电台八天开发全程 功能和界面初步设定 APP开发流程实例讲解-儒释道网络电台八天开发全程 项目发起 功能和界面初步设定 在Android Studio中完成界面设计 ...

  9. Android登录页面设计

    说到开发app,肯定要设计页面布局是吧,我也是个审美不好的人,对于开发app也只能写好功能,页面美观做不好. 今天呢,给大家奉上一篇android登录页面,当然这个页面也是我写的,不过可能并不美观,只 ...

  10. Android学习笔记(四)——EditText简单登录页面设计

    Xml代码 采用RelativeLayout 用户名: <EditTextandroid:id="@+id/et_1" android:layout_width=" ...

最新文章

  1. HTML语言的含义,HTML是什么意思
  2. 深度学习每层的通道数如何计算_深度学习基础系列(一)| 一文看懂用kersa构建模型的各层含义(掌握输出尺寸和可训练参数数量的计算方法)...
  3. css标签resolution,html/css to fit all screen resolution
  4. 用于实现 Web 服务的 SOA 编程模型,第 10 部分: SOA 用户角色
  5. Ubuntu Linux服务器配置SSH无密码登陆
  6. linux 判断上一条命令是否指令成功
  7. ubuntu上安装CLucene
  8. mysql mvcc 读写阻塞_mysql面试题MVCC原理事务隔离级别_aiailingfei的博客-CSDN博客
  9. 红茶一杯话Binder(初始篇)
  10. wpf 网易云歌词_网易云音乐粉丝半年涨500万,隔壁老樊为何成今年乐坛最大黑马 | 案例池...
  11. Eclipse 设置保护色
  12. 小程序的学习资料收集
  13. 使用Servlet来连接数据库并在前端展示
  14. 【计算机网络】计算机网络的体系结构
  15. Python-元祖-字典
  16. Win10下配置PHP环境变量
  17. 对话华为鸿蒙掌舵人王成录:真正的第一,是掌握在自己手里的第一
  18. word中插入的图片会覆盖文字
  19. 从零开始在Linux服务器上搭建JAVA开发运行环境
  20. iPhone自动旋转控制代码-IOS开发

热门文章

  1. 3D绘图 WebGl引擎----ThreeJS 3D渲染引擎
  2. vcsa7u3c安装教程
  3. does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-
  4. 接入腾讯云短信(免费+个人开发者)
  5. Flutter 1.12 最新 hotfix 与 2020 路线计划
  6. arduino小车电机不转_新一代信息技术Arduino作品要求
  7. 德国HR平台独角兽,估值超十亿美元
  8. 基于Python实现的换脸软件
  9. 计算机体系结构 第1-2章 量化设计与分析基础/指令系统原理与示例
  10. PwA 万圣节的上午