Android - 带ScrollView的TableView(不是TableRow)

时间:2014-03-05 11:54:18

标签: android scrollview expandablelistview tablelayout

我有一个包含2列和动态数量的TableRows的TableLayout。每行由TextView(第1列)和ExpandableListView(第2列)表示。

我在没有行的布局xml中定义了TableLayout。行由java代码(活动)以动态方式创建。

我想在我的TableLayout上做一个scrollView,而不是在每个TableRows上做(这是现在发生的事情)。

当我展开所有ExpandableListViews(我的表的总大小比我的活动布局大)时,我在最后一个expandableListView上只有一个滚动条,甚至在最后一行也没有。

如何滚动表而不是行或expandableListView?

layout.xml:

 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

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

    </LinearLayout>

</ScrollView>

1 个答案:

答案 0 :(得分:0)

ListView内不能有ScrollView,嵌套的ListView和任何嵌套的可滚​​动容器也是如此。