简体   繁体   English

Android-带ScrollView的TableView(不是TableRow)

[英]Android - TableView with ScrollView (not TableRow)

I have a TableLayout with 2 columns and dynamic number of TableRows. 我有一个带有2列和动态数量的TableRows的TableLayout。 Each row is represented by a TextView (1st column) and a ExpandableListView (2nd column). 每行都由一个TextView(第一列)和ExpandableListView(第二列)表示。

I have the TableLayout defined in my layout xml without rows. 我在布局XML中定义了TableLayout,但没有行。 Rows are created in a dynamic way by java code (activity). 通过Java代码(活动)以动态方式创建行。

I would like to do a scrollView on my TableLayout and not on each TableRows (this is whats happening now). 我想在我的TableLayout上而不是在每个TableRows上做一个scrollView(这是现在发生的事情)。

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. 当我展开所有ExpandableListViews(并且表的总大小大于活动布局)时,我在最后一个expandableListView上只有滚动条,甚至在最后一行也没有。

How can i scroll the Table and not the row or the expandableListView? 如何滚动表格,而不是行或ExpandableListView?

layout.xml: 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和任何嵌套的可滚​​动容器也是如此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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