2014-06-20 58 views
0

我試圖讓我的滾動視圖佔用整個屏幕的寬度。我在行上使用了匹配父項,並且在自己的滾動視圖上使用它。但它仍然不會擴展到屏幕的整個寬度。我試過其他的東西,如填充:視口,但沒有工作。 鏈接到電流輸出http://imgur.com/cKjPvF7 的截圖我把粉紅色的背景色上滾動視圖Android-如何讓滾動視圖佔據整個屏幕的寬度?

了滾動XML代碼插入滾動視圖上

<TableRow 
     android:id="@+id/tableRow3" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     > 

     <ScrollView 
      android:id="@+id/scroll" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_span="3" 
      android:background="@color/corn" 
      android:fillViewport="true" > 

      <TableLayout 
       android:id="@+id/completeTable" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" > 

      </TableLayout> 
     </ScrollView> 

    </TableRow> 

代碼行的表格行IM (不要認爲這是你應該考慮使用LinearLayout/RelativeLayout/FrameLayout您APPLI問題

<TableRow xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/tableRow1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    > 

     <TextView 
      android:id="@+id/task" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      /> 

     <Button 
      android:id="@+id/delete" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 

      android:text="@string/deleteItem" /> 

</TableRow> 
+1

爲什麼在滾動視圖之外有一個表格行? – raybaybay

+0

我使用整個應用程序的表格佈局(一致性)。表格行不應該是一個問題嗎? – committedandroider

+0

哇,這是問題。謝啦。你知道爲什麼滾動視圖不佔用整個表格行嗎? – committedandroider

回答

1

陽離子屏幕!

我認爲你的問題在這裏是因爲你的主TableLayout有很多桌子,它們大大超過了你的ScrollView。你的TableRow設置爲wrap_content,這可能會壓壞你的ScrollView

相關問題