I:Use the built-in tabhost (and inherit from the tabactivity class)
Tabhost =This. Gettabhost ();
Tabhost. addtab (tabhost. newtabspec ("tab1 ")
. Setindicator ("list") // set the display tab name
. Setcontent (new intent (this, list1.class); // sets the redirected activity.
See: http://wangjun.easymorse.com /? P = 155
II:Define our own tabhost: do not inherit tabactivity
CustomizeThe XML layout of tabhost. Note thatThe ID of tabwidget in the layout file must be defined as: Android: Id = "@ Android: ID/tabs", and the ID of framelayout must be defined as: Android: Id = "@ Android: ID/tabcontent "other controls are not restricted; otherwise, an error is returned.
Tabhost = (tabhost)This. Findviewbyid (R. Id. tabhost01 );
See http://fatkun.com/2010/06/android-tabwidget.html
Two methodsCodeSpecific can also refer to the http://aina-hk55hk.iteye.com/blog/686249