Get handle by invoking the method getTabHost() in subclass of TabActivity
Crate new tab by invoking TabHost.newTabSpec
Set string/image on tab bar by invoking TabHost.TabSpec.setIndicator (you can also customize tab bar)
Set contents in each tab by invoking TabHost.TabSpec.setContent In general, we use the following 3 methods to define the layout of each tab
Define layout of all tabs in one xml file (Plese refer to http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs1.html)
Define layout of each tab in ont xml file (Plese refer to http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs3.html)
Create layout of each tab in callback function (Plese refer to http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs2.html)
xxx
Change Text Color on Tab Indicator
1st Way TextView v; int i; TabWidget tw = (getTabHost().getTabWidget(); for (i = 0; i < tw.getChildCount();i++) { v = (TextView).getChildAt(i).findViewById(android.R.id.title)); v.setTextColor(Color.WHITE); }
2nd Way
Create a new XML file in res/drawable/ named tab_indicator.xml with the following contents: