简体   繁体   中英

android tabhost custom color

I am using Tabhost for project Tabs. I changed the color of the tab to blue but there is 2px line bellow the tab. Can any one help me to change the white color to blue. http://img816.imageshack.us/img816/228/device.png

There's probably something wrong with your screen design not related to TabHost. Did you check the screen/widgets/layouts paddings?

The following code snippet does exactly what you want. Add another Tab and that's it.

<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">
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
            android:layout_alignParentBottom="true"/>
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_above="@android:id/tabs">

            <include android:id="@+id/tab1" layout="@layout/tab1" />

            <include android:id="@+id/tab2" layout="@layout/tab2" />

            <include android:id="@+id/tab3" layout="@layout/tab3" />
        </FrameLayout>
    </RelativeLayout>
</TabHost>

Android: Tabs at the BOTTOM

I don't know if there is still no interface to customize or disable the bar below the tabs, but would be interested in an answer as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM