代码之家  ›  专栏  ›  技术社区  ›  Igor Konoplyanko

安卓:如何使冻结表头的可滚动表?

  •  0
  • Igor Konoplyanko  · 技术社区  · 14 年前

    我想知道如何用静态表头创建一个可滚动的表?(单元格中有不同的元素,如按钮、图像等)

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

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

    谢谢!

    1 回复  |  直到 14 年前
        1
  •  1
  •   Michael Mrozek    14 年前

    应该放弃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>