表格布局

以表格的形式来显示界面中的控件,表格的每一行为一个TableRow,每当一个控件添加到TableRow中,就生成一个单元格。

语法格式:

<TableLayout

  xmlns:android="http://schemas.android.com/apk/res/android"

  xmls:tools=""http://schemas.android.com/tools

  android:id="@+id/ "

  android:layout_width=" "

  android:layout_height=" "

  android:shrinkColumns=" "

  android:stretchColumns=" "

  android:collapseColumns=" ">

  <TableRow

    android:id="@+id/ "

    android:layout_width=" "

    android:layout_height=" ">

    <Widgets>

      ...

    </Widgets>

  </TableRow>

</TableLayout>

特有属性:

shrinkColumns           指定该列被收缩,列号从0开始

stretchColumns          指定该列被延伸,列号从0开始

collapseColumns         指定该列被隐藏,列号从0开始

例子:

<?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:shrinkColumns="0"
android:stretchColumns="1"
android:collapseColumns="2"> <TableRow
android:id="@+id/tablerow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"> <Button
android:id="@+id/btn1"
android:layout_height="wrap_content"
android:text="Button1"/> <Button
android:id="@+id/btn2"
android:layout_height="wrap_content"
android:text="Button2"/> <Button
android:id="@+id/btn3"
android:layout_height="wrap_content"
android:text="Button3"/>
</TableRow> <TableRow
android:id="@+id/tablerow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"> <Button
android:id="@+id/btn4"
android:layout_height="wrap_content"
android:text="Button4"/> <Button
android:id="@+id/btn5"
android:layout_height="wrap_content"
android:text="Button5"/> <Button
android:id="@+id/btn6"
android:layout_height="wrap_content"
android:text="Button6"/>
</TableRow> </TableLayout>

注意:<TableRow>中的控件不能指定layout_width

												

Android布局— — —表格布局的更多相关文章

  1. 第24讲 UI_布局 之帧布局 表格布局 绝对布局

    第24讲 UI_布局 之帧布局 表格布局 绝对布局 3. FrameLayout(帧布局) 帧布局是从屏幕的左上角(0,0)坐标开始布局,多个组件层叠排序,后一个组件总会将前一个组件所覆盖,除非最后一 ...

  2. Android课程---表格布局TableLayout

    特别注意:由于表格布局继承自线性布局,因此并不显示表格线 示例代码: <?xml version="1.0" encoding="utf-8"?> ...

  3. android 关于表格布局的认识

    表格布局(TableLayout) 使用的知识点有: 控件 TableRow:为这个表格添加一行 table的特殊属性 android:layout_column:确定此表格的列数 android:s ...

  4. Android笔记(十) Android中的布局——表格布局

    TableLayout运行我们使用表格的方式来排列控件,它的本质依然是线性布局.表格布局采用行.列的形式来管理控件,TableLayout并不需要明确的声明包含多少行多少列,而是通过添加TableRo ...

  5. android:TableLayout表格布局详解

    http://blog.csdn.net/justoneroad/article/details/6835915 这篇博文包括的内容:1.TableLayout简介2.TableLayout行列数的确 ...

  6. Android TableLayout 表格布局

    TableLayout继承LinearLayout 有多少个TableRow对象就有多少行, 列数等于最多子控件的TableRow的列数 直接在TableLayout加控件,控件会占据一行 Table ...

  7. Android first---常见布局

    ###绝对布局AbsoluteLayout    * android:layout_x="120dp"   在水平方向上偏移120像素     * android:layout_y ...

  8. 【转】TableLayout(表格布局)

    转自:http://www.cnblogs.com/zhangs1986/archive/2013/01/17/2864536.html TableLayout(表格布局) 表格布局模型以行列的形式管 ...

  9. [置顶] Android系统五大布局详解Layout

    我们知道Android系统应用程序一般是由多个Activity组成,而这些Activity以视图的形式展现在我们面前,视图都是由一个一个的组件构成的.组件就是我们常见的Button.TextEdit等 ...

随机推荐

  1. 网站后台登录aspcms 提示错误号:-2147467259,错误描述:操作必须使用一个可更新的查询。sql=update AspCms_Content set TimeStatus=0 where TimeStatus=1 and Timeing <= 解决方法。

    把data文件夹的权限改下,改成user组可以修改.写入,就好了. 还有一个问题,就是进入后台的时候提示没有访问权限的问题,解决方法看下图

  2. unity3d WorldComposer1 卫星地图生成地形

    http://blog.csdn.net/myarrow/article/details/42709113 1. 简介 1.1 TerrainComposer(TC) 一个Unity扩展工具,可用于创 ...

  3. Web打印使用printThis.js

    <script src="~/Content/JQueryTools/printThis/printThis.js"></script>

  4. selenium+python笔记3

    #!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc:学习unittest的用法 注意setUp/setUpCl ...

  5. java的HashMap与ConcurrentHashMap

    好像今天没有什么源码读,那么就来看看java的这两种HashMap有啥不一样的地方吧,在这之前先普及一下HashMap的一些基本知识: (1)放入HashMap的元素是key-value对. (2)底 ...

  6. http协议分析工具【转】

    转自:http://www.cnblogs.com/klguang/p/4624333.html

  7. (32)odoo中的编码问题

    对于全部是英文就不存在问题,但我们常用中文,这样会导致一个棘手的问题 约定: 系统Ubuntu trusty14.04 自带python2.7.6 python2.7.9 自己升级了 升级方法: -- ...

  8. 匹配session

    package dl.zhang.test.util; import java.io.IOException; import java.io.Reader; import org.apache.iba ...

  9. hdu------(1525)Euclid's Game(博弈决策树)

    Euclid's Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

  10. C++数据类型范围

    C++中有很多基本的数据类型,我们在使用过程中需要根据所需要存储数据的范围的不同而选择恰当的数据类型. Visual C++ 32 位和 64 位编译器可识别本文后面的表中的类型. int (unsi ...