zoukankan      html  css  js  c++  java
  • 寒假学习day17

    今天了解了表格布局中的三个常用属性。

    android:collapseColumns:设置需要被隐藏的列的序号
    android:shrinkColumns:设置允许被收缩的列的列序号
    android:stretchColumns:设置运行被拉伸的列的列序号

    以上这三个属性的列号都是从0开始算的,比如shrinkColunmns = "2",对应的是第三列!
    可以设置多个,用逗号隔开比如"0,2",如果是所有列都生效,则用"*"号即可
    除了这三个常用属性,还有两个属性,分别就是跳格子以及合并单元格,这和HTML中的Table类似:

    android:layout_column="2":表示的就是跳过第二个,直接显示到第三个格子处,从1开始算的!
    android:layout_span="4":表示合并4个单元格,也就说这个组件占4个单元格

    属性使用示例:

    ①collapseColumns(隐藏列)

    流程:在TableRow中定义5个按钮后,接着在最外层的TableLayout中添加以下属性: android:collapseColumns = "0,2",就是隐藏第一与第三列,代码如下:

    <TableLayout  
        android:id="@+id/TableLayout2"  
        android:layout_width="fill_parent"  
        android:layout_height="wrap_content"  
        android:collapseColumns="0,2" >  
    
        <TableRow>  
    
            <Button  
                android:layout_width="wrap_content"  
                android:layout_height="wrap_content"  
                android:text="one" />  
    
            <Button  
                android:layout_width="wrap_content"  
                android:layout_height="wrap_content"  
                android:text="two" />  
    
            <Button  
                android:layout_width="wrap_content"  
                android:layout_height="wrap_content"  
                android:text="three" />  
    
            <Button  
                android:layout_width="wrap_content"  
                android:layout_height="wrap_content"  
                android:text="four" />  
    
            <Button  
                android:layout_width="wrap_content"  
                android:layout_height="wrap_content"  
                android:text="five" />  
        </TableRow>
    </TableLayout>

    运行效果图:

  • 相关阅读:
    mysql存储过程基本函数
    Java多线程程序设计详细解析
    手把手教你写Undo、Redo程序
    mysql存储过程学习总结-操作符
    深入解析ATL第二版(ATL8.0)笔记--(2.3节)
    mysql 5.0存储过程学习总结
    php判断浏览器和语言
    Windows7系统环境安装配置PHP开发环境
    Nginx环境下Php安装
    php学习
  • 原文地址:https://www.cnblogs.com/lxywsx/p/14905697.html
Copyright © 2011-2022 走看看