Android:如何使用冻结的表格标题创建可滚动的表格?

Android:如何使用冻结的表格标题创建可滚动的表格?,android,Android,我想知道我怎样才能制作一个带有静态表头的可滚动表格?(单元格中有不同的元素,如按钮、图像等) 我已经做了一些,但我不知道如何使不同表中的列在宽度上相互匹配 <TableLayout> <TableRow> Table headers... </TableRow> <ScrollView> <TableLayout > <!-- Table content--></

我想知道我怎样才能制作一个带有静态表头的可滚动表格?(单元格中有不同的元素,如按钮、图像等)

我已经做了一些,但我不知道如何使不同表中的列在宽度上相互匹配

<TableLayout>
    <TableRow>
        Table headers...
    </TableRow>
    <ScrollView>
        <TableLayout > <!-- Table content--></TableLayout >
    </ScrollView>
</TableLayout>

表格标题。。。

谢谢

您应该放弃ListView或GridView的TableLayout 然后使用相对论

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="wrap_parent"
    android:laout_height="wrap_content"
    android:alignParentTop="true"
    android:id="@+id/buttons">
 <!-- Your Buttons Here -->
 </LinearLayout>
 <GridView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@id/buttons"/>
 </RelativeLayout>


以及列的大小如何与每列的标题相同?将线性布局中按钮的宽度设置为0,将其权重设置为1,然后只需将gridview中的列数设置为您拥有的相同按钮数即可。