zoukankan      html  css  js  c++  java
  • 安卓学习-界面-布局-TableLayout

    TableLayout继承了LinearLayout,算是特殊的线性布局,通过tablerow来添加行,如果直接用普通的ui控件,那么直接就独占一行

    TableLayout继承了LinearLayout因此LinearLayout支持的属性TableLayout也同样支持,下面几个是特有的

    XML属性 相关方法 说明
    android:collapseColumns setColumnCollapsed(int columnIndex, boolean isCollapsed) 隐藏制定列,多个列用逗号隔开,下标从0开始
    android:shrinkColumns setShrinkAllColumns

    可以被收缩列的序号,

    java代码只能设置所有的,无法制定某列

    android:stretchColumns setStretchAllColumns

    可以被拉伸列的序号

    java代码只能设置所有的,无法制定某列

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
        <!--第3列允许被拉伸,下标从0开始 -->
        <!--第4列允许被收缩,下标从0开始 -->
        <TableLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
             android:stretchColumns="2"
             android:shrinkColumns="3">    
            <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                <Button
                    android:id="@+id/button4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="1" />
                <Button
                    android:id="@+id/button3"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="2" />
                <Button
                    android:id="@+id/button2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="3拉伸的按钮" />
                <Button
                    android:id="@+id/button1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="4" />
            </TableRow>
            <TableRow
                android:id="@+id/tableRow2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
                <Button
                    android:id="@+id/button6"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="1" />
                <Button
                    android:id="@+id/button7"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="2" />
                <Button
                    android:id="@+id/button5"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="3" />
            </TableRow>
            <Button
                android:id="@+id/button8"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button" />
        </TableLayout>
    </LinearLayout>
    View Code
  • 相关阅读:
    pdflush的工作原理
    proc/sys/net/ipv4/下各项的意义
    Linux系统调用--getrlimit()与setrlimit()函数详解
    定位多线程内存越界问题实践总结
    Linux动态频率调节系统CPUFreq之三:governor
    Linux动态频率调节系统CPUFreq之二:核心(core)架构与API
    Linux动态频率调节系统CPUFreq之一:概述
    ubuntu cpu频率控制
    ThinkPHP5.1的数据库链接和增删改查
    php 常用的常量
  • 原文地址:https://www.cnblogs.com/weijj/p/3924756.html
Copyright © 2011-2022 走看看