2

下部にタブホストがあり、他の記事がいくつかのリストビューとしてある多くの情報(記事)を含むフラグメントがあります。問題は、タブを選択して 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 に答える