Skip to content Skip to sidebar Skip to footer

Tabwidget Doesn't Fill In Horizontalscrollview

I want to show tabs width horizontal scrollbar. I tried to implement like this How do you set tab view to scroll? But the tabs doesn't fill the width. How to fix it?

Solution 1:

Solved it! Use android:fillViewport="true" and remove LinearLayout.

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    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">

        <HorizontalScrollView
            android:id="@+id/horizontalScrollView1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:fillViewport="true">

                <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content" >

                </TabWidget>

        </HorizontalScrollView>

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

        </FrameLayout>

    </LinearLayout>

    <ProgressBar
        android:id="@+id/destinationProgressBar"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center" />

</TabHost>

Post a Comment for "Tabwidget Doesn't Fill In Horizontalscrollview"