简体   繁体   中英

Android - TableView with ScrollView (not TableRow)

I have a TableLayout with 2 columns and dynamic number of TableRows. Each row is represented by a TextView (1st column) and a ExpandableListView (2nd column).

I have the TableLayout defined in my layout xml without rows. Rows are created in a dynamic way by java code (activity).

I would like to do a scrollView on my TableLayout and not on each TableRows (this is whats happening now).

When i expand all ExpandableListViews (and total size of my table goes bigger than my activity layout) i only have a scroll bar on the last expandableListView, and not even on the last row.

How can i scroll the Table and not the row or the 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>

您不能在ScrollView使用ListView ,嵌套的ListViews和任何嵌套的可滚​​动容器也是如此。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM