特别注意:由于表格布局继承自线性布局,因此并不显示表格线

示例代码:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="1,2"> <TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="用户名:"/> <EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入用户名"
android:layout_span="2"/>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密码:"/> <EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入密码"
android:password="true"
android:layout_span="2"/>
</TableRow>
<TableRow>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="登陆"
android:layout_weight="1"/> <Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="注册"
android:id="@+id/button2"
android:layout_weight="1"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="取消"
android:layout_weight="1"/>
</TableRow> </TableLayout>

效果图:

效果图上面有绿色的条,可以显示行列的距离

Android课程---表格布局TableLayout的更多相关文章

  1. .Net程序猿玩转Android开发---(8)表格布局TableLayout

    表格布局TableLayout是Android中比較经常使用的一个布局控件,既然是表格,肯定有行和列,TableLayout中的行有TableRow组成.列依据每行控件的数量来确定 假如第一行有3个控 ...

  2. Android 自学之表格布局 TableLayout

    表格布局(TableLayout),表格布局采用行.列的形式来管理UI组件,TableLayout并不需要明确的声明多少行,多少列,而是通过TableRow.其他组件来控制表格的行数和列数. 每次想T ...

  3. Android布局_表格布局TableLayout

    一.TableLayout概述 TableLayout表格布局模型以行列的形式管理子控件,每一行为一个TableRow的对象,当然也可以是一个View的对象 二.TableLayout的全局属性  1 ...

  4. Android 表格布局<TableLayout>

    表格布局即,tableLayout,表格布局通过行.列的形式来管理UI组件,TablelLayout并不需要明确地声明包含多少行.多少列,而是通过TableRow,以及其他组件来控制表格的行数和列数, ...

  5. Android开发5:布局管理器2(表格布局TableLayout)

    版本:Android4.3 API18  学习整理:liuxinming 概念      TableLayout继承了LinearLayout,因此它的本质依然是线性布局管理器.      表格布局采 ...

  6. Android中的表格布局TableLayout

    表格布局最基本的三个属性: XML代码实例: <?xml version="1.0" encoding="utf-8"?> <LinearLa ...

  7. Android——布局(线性布局linearLayout,表格布局TableLayout,帧布局FrameLayout)

    线性布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:androi ...

  8. Android 表格布局 TableLayout

    属性介绍 stretchColumns:列被拉伸 shrinkColumns:列被收缩 collapseColumns:列被隐藏 举例测试 <TableLayout android:id=&qu ...

  9. 界面布局之表格布局TableLayout+TableRow

    一.基础知识: TableLayout置底,TableRow在TableLayout的上面,而Button.TextView等控件就在TableRow之上, 另外,TableLayout之上也可以单独 ...

随机推荐

  1. javascript优化--12模式(设计模式)03

    观察者模式 通过创建一个可观察的对象,当发生一个感兴趣的事件时将该事件通告给所有观察者,从而形成松散的耦合 订阅杂志 //发布者对象 var publisher = { subscribers: { ...

  2. [转] FastMM、FastCode、FastMove的使用

    http://blog.csdn.net/akof1314/article/details/6524767 FastMM是一个替换Embarcadero Delphi Win32应用程序的快速内存管理 ...

  3. Hadoop 分布式环境搭建

    一.前期环境 安装概览 IP Host Name Software Node 192.168.23.128 ae01 JDK 1.7 NameNode, SecondaryNameNode, Data ...

  4. uva 107 - The Cat in the Hat

     The Cat in the Hat  Background (An homage to Theodore Seuss Geisel) The Cat in the Hat is a nasty c ...

  5. regex: add quote for words in Notepad++

    assuming words only contain a-zA-Z0-9. search: (\<[a-zA-Z0-9]+\>) replace: "\1"

  6. iOS学习05C语言函数

    本次主要是学习和理解函数,函数树状图如下: 1.函数的声明和定义 函数定义的四要素分别为: 返回值类型 :函数的结果值类型,函数不能返回数组. 指定返回类型是void类型说明函数没有返回值. 函数名 ...

  7. 20145308刘昊阳 《Java程序设计》第3周学习总结

    20145308刘昊阳 <Java程序设计>第3周学习总结 教材学习内容总结 第四章 认识对象 要产生对象必须先定义类,类是对象的设计图,对象是类的实例 类是从少数实例推广到大量相似实例的 ...

  8. ACM: 敌兵布阵 解题报告 -线段树

    敌兵布阵 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description Li ...

  9. 洛谷 P1033 自由落体 Label:模拟&&非学习区警告

    题目描述 在高为 H 的天花板上有 n 个小球,体积不计,位置分别为 0,1,2,….n-1.在地面上有一个小车(长为 L,高为 K,距原点距离为 S1).已知小球下落距离计算公式为 d=1/2*g* ...

  10. shell判断文件或者文件夹是否存在

    #!/bin/sh myPath="/var/log/httpd/" myFile="/var /log/httpd/access.log" #这里的-x 参数 ...