2011-07-26 39 views
0

我在TableLayout中有一个自定义列表适配器。此TableLayout嵌套在LinearLayout的一个内部。将自定义列表适配器添加到TableLayout

如果将新的子视图添加到列表中,列表适配器将展开。我希望TableRow的大小在列表适配器的大小增加时动态增加。当列表增长时按钮被按下。

<?xml version="1.0" encoding="utf-8"?> 
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="match_parent" android:layout_width="match_parent" 
    > 

     <LinearLayout"> 
      <!-- Draw header + sub title --> 
      <LinearLayout android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" > 
       <TextView ></TextView> 
       <TextView ></TextView> 
      </LinearLayout> 

      <LinearLayout android:orientation="horizontal"> 
       <ImageView /> 
       <LinearLayout android:orientation="vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" 
        android:layout_weight="1"> 
        <TableLayout android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_weight="1"> 
         <TableRow android:id="@+id/tr1"> 
          <CustomList android:id="@+id/mainview" 
           ndroid:layout_height="wrap_content" android:layout_width="wrap_content" /> 
         </TableRow> 
         <TableRow android:layout_height="wrap_content" 
          android:layout_width="match_parent"> 
          <Button android:layout_width="wrap_content" android:id="@+id/button1" 
           android:text="@string/buttonPrevious" android:layout_height="wrap_content"> 
          </Button> 
          <Button android:layout_width="wrap_content" android:id="@+id/button2" 
           android:text="@string/buttonNext" android:layout_height="wrap_content"></Button> 
         </TableRow> 
        </TableLayout> 
       </LinearLayout> 
       <ImageView /> 

     </LinearLayout> 
    </ScrollView> 

我必须做的改变类似改变布局在我的自定义列表适配器或其他任何充气的方式吗?

+0

的重复同样的事情[Android的ListView控件不滚动?](http://stackoverflow.com/questions/3192595/android-listview-that按照接受的答案,不做滚动)。 – blahdiblah

回答

相关问题