TableLayout中的特殊属性
来源:互联网 发布:mac照片如何复制粘贴 编辑:程序博客网 时间:2024/06/11 19:52
在TableLayout的xml文件中有以下几种特殊属性:
android:shrinkColumns="0"
android:shrinkColumns属性:该属性用于设置可收缩的列。
当收缩的列太宽以至于布局内的其他列不能完全显示时,可收缩列会纵向延伸,
压缩自己的空间,以便于其他列可以完全显示出来。
android:stretchColumns="0"
android:stretchColumns属性:该属性用于可伸展的列。
可伸展的列会自动扩展长度以填满所有可用空间。
android:collapseColumns="0"
android:collapseColumns属性:该属性用于设置隐藏列
一个完整的TableLayout布局文件的代码:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" <!-- 此处添加以上特殊属性 --> tools:context=".MainActivity" > <TableRow> <TextView android:text="@string/column1" /> <TextView android:text="@string/column2" /> <TextView android:text="@string/column3" /> </TableRow> <TextView android:layout_height="wrap_content" android:background="#fff000" android:gravity="center" android:text="单独的一个TextView" /> <TableRow> <Button android:gravity="center_horizontal" android:text="@string/merger" android:textColor="#f00" /> </TableRow> <TextView android:layout_height="wrap_content" android:background="#fa05" android:text="单独的一个TextView" /> <TableRow android:layout_height="wrap_content" > <TextView android:text="@string/empty" /> <Button android:text="@string/row2column2" /> <Button android:text="@string/row2column3" > </Button> </TableRow></TableLayout>
在string.xml文件中:<?xml version="1.0" encoding="utf-8"?><resources> <string name="app_name">4_3_4TabLayout</string> <string name="action_settings">Settings</string> <string name="hello_world">Hello world!</string> <string name="column1">第一行第一列</string> <string name="column2">第一行第二列</string> <string name="column3">第一行第三列</string> <string name="empty">最左面的可伸缩TextView</string> <string name="row2column2">第二行第三列</string> <string name="row2column3">End</string> <string name="merger">合并三个单元格</string></resources>
最终结果显示:
0 0
- TableLayout中的特殊属性
- TableLayout属性
- TableLayout属性
- Tablelayout 属性详解
- Android TableLayout 属性含义
- TableLayout 属性的设置
- TableLayout一些XMl属性
- TableLayout的属性
- RelativeLayout、TableLayout的属性
- GridView xml文档中的特殊属性
- Python中的特殊方法、属性和迭代器
- OAF中的TableLayout
- TableLayout中的widgets
- Android中的TableLayout布局
- Android TableLayout中的使用说明
- Android TableLayout中的使用说明
- Android TableLayout中的使用说明
- [读书笔记]Android中的TableLayout
- ubuntu下如何安装使用SSH?
- 【微信易信公众平台开发】写在最前面
- MATLAB与图像处理(一):图像中结构张量的求法(Structure Tensor)
- 显示用户权限
- 理解 T4 模板:<#@ parameter #> 指令
- TableLayout中的特殊属性
- RTP/RTCP(一)-H264关于RTP协议的实现
- fork - 利用信号在父子进程间传递指针的实验
- 51单片机总结之定时器
- 在访问 Internet Explorer 中的网页时,为什么收到"中止操作"错误消息?
- UML 基础:类图
- QT中线程及其同步的用法
- 你必须懂的 T4 模板:深入浅出
- 修改指定用户权限