0
    public static void setTabColor(TabHost tabhost) {
    for(int i=0;i<tabhost.getTabWidget().getChildCount();i++)
    {
        tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.BLACK); //unselected
    }
    tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(Color.BLUE); // selected
}

Please tell me where am i doing mistake...

i want to change the default background color of Tab Button, here only once in first Tab background color change but after that color is not changing when i am selecting other tab...

Please guide me, Thanks in advance...

Vishesh Chandra
  • 6,951
  • 6
  • 35
  • 38
  • Have you tried with Custom Tab Bar? – Venky Jun 14 '11 at 14:33
  • You have use Custom Tab Bar. Check this link,It will help you [Custom Tab Bar](https://stackoverflow.com/questions/5567532/android-ui-tabactivity-issue/5567823#5567823)... – Venky Jun 14 '11 at 13:50

1 Answers1

1

only once in first Tab background color change but after that color is not changing when i am selecting other tab

May you are setting this only once (onCreate only )
Try by setting it on your setOnTabChangedListener like this

tabHost.setOnTabChangedListener(new OnTabChangeListener() {

@Override
public void onTabChanged(String tabId) {
setTabColor(tabHost);

}
Labeeb Panampullan
  • 34,521
  • 28
  • 94
  • 112