-2

I am trying below code but not work properly

public static void setTabColor(TabHost tabhost) {
    for(int i=0;i<tabhost.getTabWidget().getChildCount();i++)
    {
        tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#FF0000")); //unselected
    }
    tabhost.getTabWidget().getChildAt(tabhost.getCurrentTab()).setBackgroundColor(Color.parseColor("#0000FF")); // selected
}

I want change my default color of tab.

Thank in advance

The Ray of Hope
  • 738
  • 1
  • 6
  • 16
  • http://stackoverflow.com/questions/5577688/android-change-tab-text-color-programmatically?rq=1 – Ilan Aug 07 '13 at 10:38

1 Answers1

0
TabHost tabhost = getTabHost();
for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) 
{
    RelativeLayout tv = (RelativeLayout ) tabhost.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
    tv.setBackgroungColor(.....);
} 

Just use like this...hopes it works

FarhaSameer786
  • 370
  • 1
  • 4
  • 12