Android布局管理器-使用TableLayout表格布局管理器实现简单的用户登录页面
场景
Android布局管理器-使用FrameLayout帧布局管理器显示层叠的正方形以及前景照片:
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/103839149
实现效果如下

注:
博客:
https://blog.csdn.net/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。
实现
将activity_main.xml修改为TableLayout

然后使用<TabelRow>标签代表添加一行,首行使用
android:paddingTop="200dp">
设置顶部内边距
第一行,添加空的TextView,再添加一个水平居中的TextView和一个EditText
<TableRow
android:paddingTop="200dp">
<TextView/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="账 号:"
android:textSize="18sp"
android:gravity="center_horizontal"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="输入邮箱或手机号"
/>
</TableRow>
第二行,同理,改为密码输入行,不用再设置内顶边距
<TableRow>
<TextView/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密 码:"
android:textSize="18sp"
android:gravity="center_horizontal"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="输入6-16位数字或字母"
/>
</TableRow>
第三行添加注册和登录按钮
<TableRow>
<TextView/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注 册"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="登 录"
android:background="#FF8247"
/>
</TableRow>
第四行,添加忘记密码提示
<TableRow
android:paddingTop="20dp"
>
<TextView/>
<TextView/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF4500"
android:text="忘记密码?"
android:gravity="right"
/>
<TextView/>
</TableRow>
完整示例代码
<?xml version="1.0" encoding="utf-8"?>
<TableLayout 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=".TableLayoutActivity"> <TableRow
android:paddingTop="200dp">
<TextView/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="账 号:"
android:textSize="18sp"
android:gravity="center_horizontal"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="输入邮箱或手机号"
/>
</TableRow> <TableRow>
<TextView/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密 码:"
android:textSize="18sp"
android:gravity="center_horizontal"
/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="输入6-16位数字或字母"
/>
</TableRow> <TableRow>
<TextView/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="注 册"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="登 录"
android:background="#FF8247"
/>
</TableRow> <TableRow
android:paddingTop="20dp"
>
<TextView/>
<TextView/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF4500"
android:text="忘记密码?"
android:gravity="right"
/>
<TextView/>
</TableRow> </TableLayout>
Android布局管理器-使用TableLayout表格布局管理器实现简单的用户登录页面的更多相关文章
- Android零基础入门第29节:善用TableLayout表格布局,事半功倍
原文:Android零基础入门第29节:善用TableLayout表格布局,事半功倍 前面学习了线性布局和相对布局,线性布局虽然方便,但如果遇到控件需要排列整齐的情况就很难达到要求,用相对布局又比较麻 ...
- android的布局-----TableLayout(表格布局)
学习导图 (1)TableLayout的相关简介 java的swing编程和html中经常会使用到表格,可见表格的应用开发中使用还是比较多的,同样android也为我们提供这样的布局方式. (2)如何 ...
- 案例:TableLayout表格布局——迷你计算器
计算器可以常用线性布局(LinearLayout)和表格布局(tableLayout).Gridlayout 今天我用的是表格布局 效果如下: 代码如下: <TableLayout xmlns: ...
- 【转】TableLayout(表格布局)
转自:http://www.cnblogs.com/zhangs1986/archive/2013/01/17/2864536.html TableLayout(表格布局) 表格布局模型以行列的形式管 ...
- android:TableLayout表格布局详解
1.TableLayout简介2.TableLayout行列数的确定3.TableLayout可设置的属性详解4.一个包含4个TableLayout布局的实例及效果图一.Tablelayout简介 ...
- Android布局-TableLayout表格布局
一.表格布局-TableLayout 1.概念 表格布局采用行列的形式来管理UI的控件.表格布局适合于有规则的布局. TableRow,用来管理行,TableRow中的一个空间占据该行的一列.若不用T ...
- android:TableLayout表格布局详解
http://blog.csdn.net/justoneroad/article/details/6835915 这篇博文包括的内容:1.TableLayout简介2.TableLayout行列数的确 ...
- Android之TableLayout表格布局
1.相关属性 1.1.常用属性 android:collapseColumns 设置需要被隐藏的列的序列号 android:shrinkColumns 设置允许被收缩的列的序列号 android:st ...
- Android TableLayout 表格布局
TableLayout继承LinearLayout 有多少个TableRow对象就有多少行, 列数等于最多子控件的TableRow的列数 直接在TableLayout加控件,控件会占据一行 Table ...
随机推荐
- Linux下socket编程基本知识
本文档主要讲解了Linux下socket编程的一些基本知识,主要包括套接字和字节序的概念,以及一些常用的结构体和函数. 本文是在网易云课堂学习过程中的记录,这个老师讲得很不错,推荐大家围观. Linu ...
- NOI2.6 8782: 乘积最大
描述 今年是国际数学联盟确定的"2000--世界数学年",又恰逢我国著名数学家华罗庚先生诞辰90周年.在华罗庚先生的家乡江苏金坛,组织了一场别开生面的数学智力竞赛的活动,你的一个好 ...
- python文件夹中文件读取踩坑
Q: 进行数据集图片预处理时,初始命名如下图(Fig1左),发现读取文件时,读取的结构并非如所设想的那样顺序读取 Fig 1 A: pyhton读取文件的时候,按照文件名的ascii码中的顺序进行逐位 ...
- Promise函数的使用
最近在做批量打印并监控显示打印进度的功能,用到了很多异步函数,很多异步函数嵌套在回调函数里面,层层嵌套,导致代码可阅读性与可维护性变得十分糟糕,而且由于都是异步执行的函数,无法知道什么时候能回调结束, ...
- python学习Day04--列表
[主要内容] 1.列表的索引: lst=[1,2,3,4,5,6] print(lst[0]) #获取第一个元素 lst[1]='你好' #改变列表中的值 2.列表的切片: lst=[ ...
- 基于H5与webGL的 3d 电子围栏展示
前言 现代工业化的推进在极大加速现代化进程的同时也带来的相应的安全隐患,在传统的可视化监控领域,一般都是基于 Web SCADA 的前端技术来实现 2D 可视化监控,本系统采用 Hightopo 的 ...
- VC实现快递查询
#include <iostream> #include <string> #include <cstdlib> #include <afxinet.h> ...
- css:html-font-size
font-family:"Helvetica Neue",Helvetica,Arial,sans-serif
- HDU_1494_dp
http://acm.hdu.edu.cn/showproblem.php?pid=1494 能量用0-14表示,dp[i][j]表示走到第i段,所剩能量j的最小时间. #include<ios ...
- 青石巷-小L的爸爸
小L有一个和谐的家. 爸爸具体职业不明,在统战部工作,刚开始和妈妈在一起工作. 妈妈是个会跳舞的语文老师. 奶奶之前也是个老师. 爷爷是个建筑师. 爸爸是最有文采的一个.在小L看来,他的一言一行,一举 ...