当前位置: 移动技术网 > IT编程>移动开发>Android > Android 表格布局 TableLayout

Android 表格布局 TableLayout

2019年11月03日  | 移动技术网IT编程  | 我要评论

bip,娜塔莉 迪伦,杀父抢子嫌犯自首

属性介绍

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>

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网