Tabhost Components is a multiple tabs can be stored in the interface container, the tab size is the same as the external container.
T The abwidget component is Tabhost title bar, click to toggle the tab.
The Tabspec component is a tab (tab page).
Tabhost Use the following steps:
1. Define a Tabhost component in the XML file and define a framelayout in it. Add content to it.
2.activity should inherit from Tabactivity.
3. Call Tabactivity's Gettabhost () method to get the Tabhost object.
4. Create and Add tabs using the Tabhost object method:
Newtabspec (String tag): Create tab
AddTab (Tabhost.tabspec tabspec): Add tab
Several controls in the layout file need to refer to an existing ID of the Android system and cannot be defined by itself:
Tabhost: @android: Id/tabhost
Tabwidget: @android: Id/tabs
Framelayout: @android: Id/tabcontent
When the Tabhost tab changes, you can use Ontabchangelistener to listen for its bound events.
Tabspec can use the setcontent (int viewId) and setcontent (Intent Intent) methods to set the contents of the tab, which means that TABSPEC can directly reprint another activity.
Android Learning Note (30): Tab tabhost