How to change the Tabs Images in the TabHost

If you wish to use different images for the selected and unselected states, then create ‘selector’ XML files in your drawables folder for each tab, e.g. tab1_selector.xml, tab2_selector.xml which should contain the following, replacing the drawable references to your images for selected and unselected states. i.e.

    <?xml version="1.0" encoding="utf-8"?>
    android:drawable="@drawable/tab1_selected_image" />
    android:drawable="@drawable/tab2_unselected_image" />

Then using the .setIndicator method as bharath wrote above you should reference your new xml drawable resource.

Leave a Comment