2

我有一个片段,其中包含大量信息(文章),底部有一个 tabhost,其他文章作为几个 listViews。问题是当我选择标签时,我的 scrollView 滚动以包含列表视图(实际上只是滚动所有内容,因此列表视图的第一项是屏幕上的第一件事),这是我不想要的。

我需要在 ScrollView 中使用 listViews,因为有很多信息要显示 + 其他相关文章等,而且布局比屏幕长得多。我解决了滚动视图中列表视图的问题,只是不知道如何禁用设置焦点在标签点击上。

这是我的布局:

<ScrollView
    android:id="@+id/category_scroll"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="130dp"
            android:src="@drawable/currency_flag_eur" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <ImageView
                android:id="@+id/imageView2"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_weight="0.24"
                android:src="@drawable/currency_flag_eur" />

            <ImageView
                android:id="@+id/imageView3"
                android:layout_width="wrap_content"
                android:layout_height="90dp"
                android:layout_weight="0.29"
                android:src="@drawable/currency_flag_eur" />
        </LinearLayout>

        <include layout="@layout/ticker" />

        <TabHost
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@android:id/tabhost"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:padding="10dp" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical" >

                <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" />

                <FrameLayout
                    android:id="@android:id/tabcontent"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="0" >

                    <ListView
                        android:id="@+id/category_top_news"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content">
                    </ListView>

                    <ListView
                        android:id="@+id/category_most_read"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content">
                    </ListView>

                    <ListView
                        android:id="@+id/category_facebook"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content" >
                    </ListView>
                </FrameLayout>
            </LinearLayout>
        </TabHost>
    </LinearLayout>
</ScrollView>
4

1 回答 1

4

如果有人在徘徊,我解决了我的问题,所以我将我的列表视图设置为

setFocusable(false)

他们停止抽搐。

于 2012-06-21T12:33:08.933 回答