Search code examples
androidandroid-layoutandroid-tabsandroid-style-tabhost

android: how to add style or background to tabhost and tabs


like the tabs in android's contact, i want to add style (or maybe it is background or something i don't know) how please ?

<?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">
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"/>
    </LinearLayout>
</TabHost>

and would you tell me where to find a good backgrounds or tabs because i am not good at designing :)


Solution

  • Here you have everything about the tab pretty much. Works with Android 1.6 and above: http://joshclemm.com/blog/?p=136

    You have to call setIndicator on your TabSpec and pass it a view instead of just text. Then you can customize that view using selectors etc.