Android布局— — —表格布局
表格布局
以表格的形式来显示界面中的控件,表格的每一行为一个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布局— — —表格布局的更多相关文章
- 第24讲 UI_布局 之帧布局 表格布局 绝对布局
第24讲 UI_布局 之帧布局 表格布局 绝对布局 3. FrameLayout(帧布局) 帧布局是从屏幕的左上角(0,0)坐标开始布局,多个组件层叠排序,后一个组件总会将前一个组件所覆盖,除非最后一 ...
- Android课程---表格布局TableLayout
特别注意:由于表格布局继承自线性布局,因此并不显示表格线 示例代码: <?xml version="1.0" encoding="utf-8"?> ...
- android 关于表格布局的认识
表格布局(TableLayout) 使用的知识点有: 控件 TableRow:为这个表格添加一行 table的特殊属性 android:layout_column:确定此表格的列数 android:s ...
- Android笔记(十) Android中的布局——表格布局
TableLayout运行我们使用表格的方式来排列控件,它的本质依然是线性布局.表格布局采用行.列的形式来管理控件,TableLayout并不需要明确的声明包含多少行多少列,而是通过添加TableRo ...
- android:TableLayout表格布局详解
http://blog.csdn.net/justoneroad/article/details/6835915 这篇博文包括的内容:1.TableLayout简介2.TableLayout行列数的确 ...
- Android TableLayout 表格布局
TableLayout继承LinearLayout 有多少个TableRow对象就有多少行, 列数等于最多子控件的TableRow的列数 直接在TableLayout加控件,控件会占据一行 Table ...
- Android first---常见布局
###绝对布局AbsoluteLayout * android:layout_x="120dp" 在水平方向上偏移120像素 * android:layout_y ...
- 【转】TableLayout(表格布局)
转自:http://www.cnblogs.com/zhangs1986/archive/2013/01/17/2864536.html TableLayout(表格布局) 表格布局模型以行列的形式管 ...
- [置顶] Android系统五大布局详解Layout
我们知道Android系统应用程序一般是由多个Activity组成,而这些Activity以视图的形式展现在我们面前,视图都是由一个一个的组件构成的.组件就是我们常见的Button.TextEdit等 ...
随机推荐
- perl中->和=>作用
-> 用法 -> 有两种用法,都和解引用有关. 第一种用法,就是解引用. 根据 -> 后面跟的符号的不同,解不同类型的引用, ->[] 表示解数组引用,->{} 表示解散 ...
- jmeter 监听的介绍
一个侦听器是一个组件,显示的结果 样本. 结果可以显示在一个树,表格,图表或简单地写入到日志中 文件. 查看的内容反应任何给定的采样器,添加的监听器” 视图 结果树 ”或“ 视图的结果表 一个测试计划 ...
- Node.js 开发模式(设计模式)
Asynchronous code & Synchronous code As we have seen in an earlier post (here), how node does th ...
- Python安装BeautifulSoup库(Windows平台下)
简介 参照官网Beautiful Soup4.4.0文档:https://www.crummy.com/software/BeautifulSoup/bs4/doc/ 安装步骤 1.到https:// ...
- Thread类的使用
在前面2篇文章分别讲到了线程和进程的由来.以及如何在Java中怎么创建线程和进程.今天我们来学习一下Thread类,在学习Thread类之前,先介绍与线程相关知识:线程的几种状态.上下文切换,然后接着 ...
- 190. Reverse Bits -- 按位反转
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in ...
- (转载)Android理解:显式和隐式Intent
Intent分两种:显式(Explicit intent)和隐式(Implicit intent). 一.显式(设置Component) 显式,即直接指定需要打开的activity对应的类. 以下多种 ...
- Checked 和 UnChecked 异常 的使用场合
异常的概念 任何的异常都是Throwable类(为何不是接口??),并且在它之下包含两个子类Error / Exception,而Error仅在当在Java虚拟机中发生动态连接失败或其它的定位失败的 ...
- oAuth协议学习
我们的项目需要为一个认证网站开发一套API,这些API可以提供给很多公司来调用,但是公司在调用之前,必须先做授权认证,由此接触到了oAuth协议. 以下内容来自网络整理 定义 OAUTH协议为用户资源 ...
- GridView72变 控件
快速预览:GridView 无代码分页排序GridView选中,编辑,取消,删除GridView正反双向排序GridView和下拉菜单 DropDownList结合GridView和CheckBox结 ...