Android TableLayout未在ScrollView内滚动

Android TableLayout未在ScrollView内滚动,android,scrollview,tablelayout,Android,Scrollview,Tablelayout,我的问题是,在代码中创建TableLayout之后,我要将它添加到活动视图中,我真的需要它是可滚动的。该表是从包含SQL查询结果的resultset创建的,根据查询本身的不同,它可能会有所不同,因此它必须是“通用”的,不总是可滚动的。我在stackoverflow这里找到了滚动问题的答案,经过一些阅读,我构建了这样的活动: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="

我的问题是,在代码中创建TableLayout之后,我要将它添加到活动视图中,我真的需要它是可滚动的。该表是从包含SQL查询结果的resultset创建的,根据查询本身的不同,它可能会有所不同,因此它必须是“通用”的,不总是可滚动的。我在stackoverflow这里找到了滚动问题的答案,经过一些阅读,我构建了这样的活动:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/textView1"
android:clickable="true"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarStyle="insideOverlay"
android:scrollbars="horizontal|vertical"
android:visibility="visible"
tools:context=".Wyswietlanie" >

<RelativeLayout
android:id="@+id/rel1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
 >

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="23dp"
    android:text="@string/wczytywanie"
    android:textAppearance="?android:attr/textAppearanceLarge" />





</RelativeLayout>
</ScrollView>
其中rl1是相对布局(通过id找到),结果是TableLayout。TableLayout会自动显示,但没有任何内容是可滚动的。没有可见的滚动条,当我用手指在滚动条上向不同方向滑动时,什么也不会发生。什么都没有。我的错在哪里?我应该用别的东西吗


(请忽略一个事实,即生成的tablelayout显然与textview重叠,我将其保存以备以后使用。)

尝试更改scrollview的布局宽度以匹配父视图

android:layout_width="match_parent"
android:layout_height="match_parent"

它仍然不起作用,至少在水平方向上不起作用。最后,我用了这个
android:layout_width="match_parent"
android:layout_height="match_parent"