/ ScrollView内の/ TabHostは、フォーカスをコンテンツに設定してスクロールします - android、listview、scrollview、android-tabhost

ScrollView内のTabHostは、コンテンツとスクロールに集中します - android、listview、scrollview、android-tabhost

私はたくさんの情報を含んでいるフラグメントを持っています2つのlistViewとして他の記事と下部にタブホストを持つ(article)。問題は、私がスクロールビューをスクロールしてリストビューを囲むようにスクロールしたとき(実際にはリストビューの最初の項目が画面の最初の項目になるようにすべてをスクロールするだけです)、これは望ましくないことです。

ScrollView内にlistViewが必要です。+追加の関連記事などを表示するための情報がたくさんあり、レイアウトは画面よりはるかに長くなります。スクロールビュー内のリストビューの問題を解決しました。無効にする方法を理解できません タブクリックにフォーカスを設定します。

これが私のレイアウトです。

<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>

回答:

回答№1は4

誰かが放浪していたら私は私の問題を解決したので私は私の中に私のリストビューを設定しました。

setFocusable(false)

そして彼らはぐいと動くのをやめた。