表格布局

以表格的形式来显示界面中的控件,表格的每一行为一个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. VB6 GDI+ 入门教程[2] GDI+初始化

    http://vistaswx.com/blog/article/category/tutorial/page/2 VB6 GDI+ 入门教程[2] GDI+初始化 2009 年 6 月 18 日 7 ...

  2. java 抽象类

    抽象类: 1)函数没有方法体,就必须用abstract修饰. 2)抽象函数所在的类必须也是抽象的. 3)非抽象的类继承于抽象类,必须实现其全部方法. 4)抽象类中可以存在抽象方法,也可以不存在. 5) ...

  3. dede标签调用

    关键描述调用标签: <meta name="keywords" content="{dede:field name='keywords'/}">&l ...

  4. C++疑难杂症

    1.如果在类成员函数外部显示的调用其父类的某个接口. 2.对于一个父类的成员, 子类如何在构造函数中对其进行特殊的定制生成. 3.对于一个需要用常量来声明的类型, 如何定义这个常量.   比如int ...

  5. c语言数据结构:01背包问题-------动态规划

    两天的时间都在学习动态规划:小作业(01背包问题:) 数据结构老师布置的这个小作业还真是让人伤头脑,自己实在想不出来了便去网上寻找讲解,看到一篇不错的文章: http://www.cnblogs.co ...

  6. Struts2动态结果(${})and全局结果(global-results)

    动态结果 例:根据判定动态结果区分用户进行登录 1.先在TestAction类中进行判定赋值 public class TestAction extends ActionSupport { priva ...

  7. Hibernate缓存机制

    缓存是介于应用程序和物理数据源之间,其作用是为了降低应用程序对物理数据源访问的频次,从而提高了应用的运行性能.缓存内的数据是对物理数据源中的数据的复制,应用程序在运行时从缓存读写数据,在特定的时刻或事 ...

  8. git的一个merge流程

    git merge testSupport 合并testSupport分支代码到当前分支. 若无冲突发生,git commit -m "RM ID:5094",在git push即 ...

  9. JDE客户端get时报错“ERROR:fetch from table F0101 failed”

    客户端开发时发现总报错误“ERROR:fetch from table F0101 failed” 原因是用户ID在地址名册中找不到地址号.修改用户地址号即可.如下图所示

  10. tar 排除指定目录 –exclude

    假设 test目录下有 1 2 3 4 5 这5个目录, 1下有6 7两个目录, 现在要将3 4 5 6目录tar打包,2和1下的6这两个目录不要.命令如下: Example[www]#cd test ...