2013-03-04 323 views
0

我想填充我的表的第一行只有一個按鈕..和第二行分爲兩個按鈕,但我不能這樣做.. 它出現總是這樣:表填充不能填充行按鈕

http://s12.postimage.org/4y5qjxcod/table.png

我已經添加行: 機器人:stretchColumns = 「」 機器人:shrinkColumns =「

任何線索,爲什麼?這是我的XML是如何在瞬間:

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/tableLayout1" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:stretchColumns="*" 
    android:shrinkColumns="*" > 

    <!-- 1 column --> 
    <TableRow 
     android:id="@+id/tableRow1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 

     <Button 
      android:id="@+id/button1" 
      android:text="Column 2" /> 
    </TableRow> 

    <!-- 2 columns --> 
    <TableRow 
     android:id="@+id/tableRow2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 

     <Button 
      android:id="@+id/button2" 
      android:text="Column 3" /> 

     <Button 
      android:id="@+id/button3" 
      android:text="Column 4" /> 
    </TableRow> 





</TableLayout> 

回答

1

添加機器人:layout_span = 「2」 你的第一個按鈕:

<Button 
    android:id="@+id/button1" 
    android:layout_span="2"  
    android:text="Column 2" /> 
+0

你救了我的一天,非常感謝隊友;) – TiagoM 2013-03-04 11:07:10