zoukankan      html  css  js  c++  java
  • Android 表格布局 TableLayout

    属性介绍

    stretchColumns:列被拉伸

    shrinkColumns:列被收缩

    collapseColumns:列被隐藏

    举例测试

        <TableLayout
            android:id="@+id/table1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:stretchColumns="0" >
    
            <TableRow
                android:id="@+id/row1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >
    
                <TextView
                    android:id="@+id/textView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="#fd8d8d"
                    android:text="測試表格布局"
                    android:textColor="#000000" />
            </TableRow>
        </TableLayout>
    
        <TableLayout
            android:id="@+id/table2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:shrinkColumns="0,1,2,3" >
    
            <TableRow
                android:id="@+id/row2"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >
    
                <Button
                    android:id="@+id/button1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="button1" />
    
                <Button
                    android:id="@+id/button2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="button2" />
    
                <Button
                    android:id="@+id/button3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="button3" />
    
                <Button
                    android:id="@+id/button4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="button4" />
            </TableRow>
        </TableLayout>
    
        <TableLayout
            android:id="@+id/table3"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:stretchColumns="0" >
    
            <TableRow
                android:id="@+id/row3"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >
    
                <EditText
                    android:id="@+id/editText"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:text="查詢" />
            </TableRow>
        </TableLayout>

    image

  • 相关阅读:
    关于update set from,第一次碰到,汗!
    列表CheckBox全选 结合DataGrid 进行删除操作
    DataBinder.Eval的基本格式 效率 比较
    [转载](c#)数据结构与算法分析 栈与队列
    [转载]怎样设计递归算法
    Java httpclient.CloseableHttpClient跳过https证书验证
    LeetCode129求根节点到叶节点数字之和
    LeetCode117填充每个节点的下一个右侧节点指针 II
    LeetCode131分割回文串
    LeetCode130被围绕的区域
  • 原文地址:https://www.cnblogs.com/zhangxuechao/p/11787167.html
Copyright © 2011-2022 走看看