2012-09-27 46 views
0

我在佈局中有很多行,我需要一個部分滾動視圖。我想修復linearlayout和第一個表格,剩下的就是Scrollview。現在,我有這樣的代碼:Partial ScrollView - XML Android

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"> 

    <LinearLayout> 

     <TextView 
     /> 
    </LinearLayout> 

    <TableRow 
      > 

     <TextView 
      /> 

     <TextView 
      /> 

     <TextView 
      /> 
    </TableRow> 
</TableLayout> 

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 

<TableLayout 
     > 

    <TableRow 
      > 
     <TextView 
       /> 
     <TextView 
       /> 
     <TextView 
       /> 
    </TableRow> 

    <TableRow 
      > 
     <TextView 
       /> 
     <TextView 
       /> 
     <TextView 
       /> 
    </TableRow> 
</TableLayout> 
</ScrollView> 

但是不編譯。我應該如何使用scrollview來實現我的目標?

謝謝:)

回答

2
  • 在你需要在每個XML元素來定義android:layout_heightandroid:layout_width爲它來編譯最起碼。
  • 佈局只能包含1個父元素。你需要將整個東西包裝在LinearLayout或任何適合你需求的佈局中。