TableLayout 表格布局管理器
来源:互联网 发布:淘宝账号不用了怎么办 编辑:程序博客网 时间:2024/04/29 09:52
与表格相似,以行和列的形式来管理放入其中的UI组件,在表格布局中,可以添加多个<TableRow>标记,每个<TableRow>标记占用一行。由于<TableRow>也是容器,所以还可以在此容器中添加其他组件,没添加一个组件,表格就会增加一列。列可以被隐藏,也可以被收缩或拉伸。
基本语法:
<TableLayout xmls:android="..."
属性列表
>
<TableRow 属性列表> 需要添加的UI组件</TableRow>
</TableLayout>
本身特有属性:
android:collapseColumns(设置需要隐藏的列的序列号,多个序列号用","分隔)
android:shrinkColumns(设置需要收缩的列的序列号,多个序列号用","分隔)
android:stretchColumns(设置需要拉伸的列的序列号,多个序列号用","分隔)
简单实例代码:
<?xml version="1.0" encoding="utf-8"?><TableLayout android:id="@+id/tableLayout1"android:layout_width="fill_parent" android:layout_height="fill_parent"xmlns:android="http://schemas.android.com/apk/res/android"android:background="@drawable/background_a"android:gravity="center_vertical"android:stretchColumns="0,3"><!-- 第一行--><TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content"android:layout_height="wrap_content"><TextView/><TextView android:text="用户名" android:id="@+id/textView1" android:layout_width="wrap_content"android:textSize="24px" android:layout_height="wrap_content"/><EditText android:id="@+id/editText1" android:textSize="24px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minWidth="200px"/><TextView /></TableRow><!-- 第二行--><TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content"android:layout_height="wrap_content"><TextView/><TextView android:text="密码" android:id="@+id/textView2" android:textSize="24px" android:layout_width="wrap_content" android:layout_height="wrap_content"/><EditText android:layout_height="wrap_content" android:layout_width="wrap_content" android:textSize="24px" android:id="@+id/editText2" android:inputType="textPassword"/><TextView /></TableRow><!-- 第三行--><TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content"android:layout_height="wrap_content"><TextView/><Button android:text="登录" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"/><Button android:text="取消? android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"/><TextView /></TableRow></TableLayout>
- TableLayout 表格布局管理器
- Android表格布局管理器TableLayout
- Android布局方式之表格布局管理器(TableLayout)
- Android开发5:布局管理器2(表格布局TableLayout)
- Android学习笔记13:表格布局管理器TableLayout
- android-TableLayout 表格布局
- TableLayout表格布局UI
- 表格布局 TableLayout
- Android 表格布局<TableLayout>
- 表格布局TableLayout
- TableLayout表格布局学习
- android:TableLayout表格布局
- android:TableLayout表格布局
- TableLayout表格布局详解
- TableLayout表格布局详解
- TableLayout表格布局详解
- TableLayout(表格布局)
- Android TableLayout表格布局
- Linux 系统监测工具 tsar
- 个人汇总的SEO知识,高手指教
- 第五章 CLOVER
- 浅谈消息队列
- Freescale PowerPC架构mpc8349E开发环境搭建
- TableLayout 表格布局管理器
- 第四次课后作业
- 【leetcode】String to Integer (atoi)
- android Content Provider 详解
- android 调用系统程序
- 爬山
- C语言编程规范-注释
- 如何利用百度地图JSAPI生成H7N9分布图?
- ZOJ 3329 One Person Game 概率DP