Recently, I made a simple application that utilizes a Tabhost. However, I'm unable to set the color to it . I've set the sample code below. How will I be able to add colors to the current code ? it would be a great help if I can recieve a tip or help.
Resources res = getResources();
TabHost tabHost = getTabHost();
TabSpec spec;
Intent intent;
//tabHost.getTabWidget().getChildAt(0).setBackgroundColor(Color.parseColor("#C0392B"));
intent = new Intent().setClass(this, SecondActivity.class);
spec = tabHost.newTabSpec("Second Activity").setIndicator(res.getString(R.string.act_second), res.getDrawable(R.drawable.ic_tab)).setContent(intent);
tabHost.addTab(spec);
I set color of tabHost
in my tabChanged
method like:
for( int i=0;i<mTabHost.getTabWidget().getChildCount();i++)
{
mTabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#7392B5"));
}
mTabHost.getTabWidget().getChildAt(mTabHost.getCurrentTab()).setBackgroundColor(Color.parseColor("#4E4E9C"));