表格布局

以表格的形式来显示界面中的控件,表格的每一行为一个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. ogre入门笔记

    ogre作为一款开源的非商业渲染引擎, 除去效率不谈, 其设计结构十分优雅, 值得游戏从业者拥有和学习.本篇笔记基于ogre v1.9. 1.代码模块 ogre的核心代码分布如下图: ogreMain ...

  2. Android屏幕适配原理

    几个概念: 1) 屏幕密度(dpi) :dot per inch,即每英寸像素数. ldpi(120),mdpi(160),hdpi(240),xhdpi(320) 计算方法: 以480x854,4. ...

  3. 【CodeVS 1014】装箱问题

    题目描述 有一个箱子容量为V(正整数,0<=V<=20000),同时有n个物品(0<n<=30),每个物品有一个体积(正整数). 要求n个物品中,任取若干个装入箱内,使箱子的剩 ...

  4. js将long日期格式转换为标准日期格式

    <script language="javascript"> //扩展Date的format方法 Date.prototype.format = function (f ...

  5. this(C# 参考)

    原文地址:https://msdn.microsoft.com/zh-cn/library/dk1507sz.aspx this 关键字引用类的当前实例,还可用作扩展方法的第一个参数的修饰符. 注意 ...

  6. 在csdn里markdown感受

    先来一个百度百科   Markdown是一种可以使用普通文本编辑器编写的标记语言,通过简单的标记语法,它可以使普通文本内容具有一定的格式.   Markdown具有一系列衍生版本,用于扩展Markdo ...

  7. 补交git、ssh

    本来应该早就应该交的,自己给忘记了,非常抱歉,现在补交上来 词频统计: 代码地址:https://coding.net/u/liuff/p/cipin/git ssh:git@git.coding.n ...

  8. 张艾迪(创始人):出现在世界224C之前的这些时间

    出现在世界224C之前的这些时间 坐在大巴车上.用手塞住耳朵.繁杂的大巴车上.总会听见不喜欢听的声音.那时只有22.23岁的我.就像发明一些东西把所有不喜欢的声音都屏蔽掉.就像防火墙一样.那时候拥抱所 ...

  9. SqlServer中把结果集放到到临时表的方法

    一. SELECT INTO   1. 使用select into会自动生成临时表,不需要事先创建   select * into #temp from sysobjects   01. 把存储过程结 ...

  10. SAP资产变动明细

    *&---------------------------------------------------------------------* *& Report ZFIR027 * ...