2010-08-29 41 views
0

我想知道如何使用靜態表頭創建一個可滾動表格? (與像按鈕,圖像等單元格中的不同元素)Android:如何製作凍結表頭的可滾動表格?

我已經提出了一些,但我不知道如何使不同的表中的列按寬度匹配。

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

謝謝!

回答

1

你應該溝TableLayout的一個ListView GridView控件或然後 使用RelativeLayout的

<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

和列如何將大小相同標題爲每列? – 2010-08-30 18:04:21

+0

將線性佈局中按鈕的寬度設置爲0並將它們的權重設置爲1,然後將gridview中的列數設置爲相同數量的按鈕。 – schwiz 2010-08-31 15:24:29