Reputation: 525
I have a Fragment that has contains lots of info (article) with a tabhost at a bottom with other articles as a couple of listViews. The problem is when i select tabs my scrollView scrolls to encompass the listview (actually just scroll everything so the first item of the list view is the first thing on the screen), which i do not want.
I need listViews inside ScrollView because there are a lot of information to show + additional related articles and such, and the layout is much longer than the screen. I solved the problem of listviews inside scrollview, just can't figure out how to disable setting focus on tab click.
here is my layout:
<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>
Upvotes: 2
Views: 1994
Reputation: 525
If anyone was wandering i solved my problem so i set my listviews inside my to
setFocusable(false)
and they stopped jerking around.
Upvotes: 4