2011-04-15 23 views
2

這是否意味着您可以創建一個空列的表格行?TableRow.addView(View child,int index)中的「index」代表什麼?

我想做這樣一個TableLayout:

+--------------+---------------------+ 
+ *Nothing* +  LinearLayout + 
+------------------------------------+ 
+ LinearLayout +  *Nothing*  + 
+--------------+---------------------+ 

是否有可能與指數的財產?

TableRow topTableRow = new TableRow(context); 
topTableRow.addView(xAxisScrollView, 1); 
addView(topTableRow); 

TableRow bottomTableRow = new TableRow(context); 
bottomTableRow.addView(yAxisScrollView, 0); 
addView(bottomTableRow); 

回答

0

正如你可以讀in the documentation,它應該是可能的。但我只是試試它。它在2分鐘內完成;)

+1

我試過這個,但它拋出IndexOutOfBoundException ... :( – Codii 2011-04-15 09:00:12

+0

好吧,我明白了,但這個答案應該可以幫助你:http://stackoverflow.com/q/3345189/329637 – 2011-04-15 09:05:19

+0

謝謝,我會嘗試使用GridView – Codii 2011-04-15 09:13:25

相關問題