专业编程基础技术教程

网站首页 > 基础教程 正文

android 学习,TableLayout

ccvgpt 2024-08-15 20:31:59 基础教程 9 ℃

这个就和Html里的table属性差不多,只不过,这个table的参数不是很,常用参数只有几个。

<TableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:collapseColumns="4"
        android:stretchColumns="2"
        android:shrinkColumns="1">
        <TableRow>
            <androidx.appcompat.widget.AppCompatButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="一个按钮1"/>
            <androidx.appcompat.widget.AppCompatButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="一个按钮2"/>
            <androidx.appcompat.widget.AppCompatButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="一个按钮3"/>
            <androidx.appcompat.widget.AppCompatButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="一个按钮4"/>
            <androidx.appcompat.widget.AppCompatButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="一个按钮5"/>
        </TableRow>
        <TableRow>
            <androidx.appcompat.widget.AppCompatButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="一个按钮1"/>
            <androidx.appcompat.widget.AppCompatButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="一个按钮2"/>
            <androidx.appcompat.widget.AppCompatButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="一个按钮3"/>
        </TableRow>
        <TableRow>
            <androidx.appcompat.widget.AppCompatButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="一个按钮1"
                android:layout_column="1"
                android:layout_span="2"/>
        </TableRow>
    </TableLayout>

android 学习,TableLayout

Tags:

最近发表
标签列表