2013-04-03 52 views
1

我很難找出它,模擬器的慢度增加了它。 有人可以給我一些指針在這裏..爲什麼我的滾動視圖中的按鈕沒有填滿寬度?

我打算做的是推動這些盒子的寬度,通常發生的是,按鈕只是包裝起來,留下了右側的空白空間。 繼承人的XML代碼我已經固定爲像永遠....

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="150dp" > 

     <TableLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:stretchColumns="1" > 

     <TableRow> 

      <Button 
       android:id="@+id/bOne" 
       style="?android:attr/buttonStyleSmall" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="Radio Buttons" /> 
     </TableRow> 

     <TableRow> 

      <Button 
       android:id="@+id/bTwo" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="List View" /> 
     </TableRow> 

     <TableRow> 

      <Button 
       android:id="@+id/bThree" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="Button" /> 
     </TableRow> 

     <TableRow> 

      <Button 
       android:id="@+id/bFour" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="Button" /> 
     </TableRow> 

     <TableRow> 

      <Button 
       android:id="@+id/bFive" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="Button" /> 
     </TableRow> 
    </TableLayout> 
    </ScrollView> 
+0

嘿,這是一個非常令人驚訝的結果。當我在模擬器中查看您的xml時,我會得到同樣的結果。我本來希望按鈕能夠填滿整個過程。我知道它對你沒有任何幫助,但至少我看到了你所看到的。 – HalR 2013-04-03 19:31:24

+0

您是否嘗試過使用水平方向的'LinearLayout'?你應該能夠把所有的butons放在一行而不是換行。 – Rarw 2013-04-03 20:30:21

+0

生病嘗試@Rarw,我的'LinearLayout'是垂直方向,希望能夠解決它很快 – 2013-04-03 23:59:24

回答

0

在tablelayout你有機器人:stretchColumns =「1」 列開始索引從0開始,從而要麼刪除strechcolumns或將其值更改爲0.

相關問題