Android 在滚动视图中带有选项卡的TabHost-滚动仅适用于一个选项卡

Android 在滚动视图中带有选项卡的TabHost-滚动仅适用于一个选项卡,android,android-layout,Android,Android Layout,我有三个选项卡的TabHost。其中一个选项卡包含ListActivity。我希望所有三个选项卡都可以滚动。起初,我将FrameLayout(tabcontent)放在ScrollView中,但我不能将ListActivity放在ScrollView中,所以我为每个选项卡添加了ScrollView(第三个带有ListActivity的选项卡除外)。现在,滚动仅适用于第二个选项卡。当我尝试滚动第一个滚动条时,一个滚动条正在移动,但内容没有移动。看起来只有包含第二个选项卡的ScrollView才有焦

我有三个选项卡的TabHost。其中一个选项卡包含ListActivity。我希望所有三个选项卡都可以滚动。起初,我将FrameLayout(tabcontent)放在ScrollView中,但我不能将ListActivity放在ScrollView中,所以我为每个选项卡添加了ScrollView(第三个带有ListActivity的选项卡除外)。现在,滚动仅适用于第二个选项卡。当我尝试滚动第一个滚动条时,一个滚动条正在移动,但内容没有移动。看起来只有包含第二个选项卡的ScrollView才有焦点,即使我在第一个选项卡上

我的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black">

    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp">
            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" />
            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">
                <!-- TAB1 -->
                <ScrollView
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent">
                    <LinearLayout
                        android:id="@+id/tab1Layout"
                        android:orientation="vertical"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:padding="5dp">
                        <TextView
                            anddroid:id="@+id/textview11"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" />
                        <TextView
                            anddroid:id="@+id/textview12"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" />
                        <TextView
                            anddroid:id="@+id/textview13"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" />
                        <TextView
                            anddroid:id="@+id/textview14"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" />
                            <!-- FEW MORE TEXTVIEWS -->
                    </LinearLayout>
                </ScrollView>
                <!-- TAB 2 -->
                <ScrollView
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent">
                    <LinearLayout
                        android:id="@+id/tab2Layout"
                        android:orientation="vertical"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:padding="5dp">
                        <TextView
                            anddroid:id="@+id/textview21"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" />
                        <TextView
                            anddroid:id="@+id/textview22"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" />
                        <TextView
                            anddroid:id="@+id/textview23"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" />
                        <TextView
                            anddroid:id="@+id/textview24"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content" />
                            <!-- FEW MORE TEXTVIEWS -->
                    </LinearLayout>
                </ScrollView>
                <!-- TAB3 -->
                <!-- ListActivity here -->
            </FrameLayout>
        </LinearLayout>
    </TabHost>
</LinearLayout>

不是这样的

您不能为选项卡使用单独的滚动视图或任何视图 TabWidget本身包含选项卡,对于内容,您可以使用FramLayout 此FramLayout将包含您要通过单击Tab打开的活动