Tabhost is the entire tab container, which contains the tabwidget(tab label) and the framelayout(tab display content) two parts
There are two ways of implementing this:
1. Inheriting tabactivity
2. Inheriting fragmentlayout
Method One: Inherit Tabactivity
Get Tabhost from the Gettabhost () method in Tabactivity, and then set the label layout:
Attention:
1.TabHost must be set Android:id to @android:id/tabhost
2.TabWidget must be set Android:id to @android:id/tabs
3.FrameLayout must be set Android:id to @android:id/tabcontent
Otherwise, a similar error will occur:
Method Two: Inherit Fragmentlayout
Get Tabhost by Findviewbyid (R.id.mytab) method
Attention:
1.TabHost can be arbitrarily set android:id= "@+/id/mytab"
2.TabWidget must be set Android:id to @android:id/tabs
3.FrameLayout must be set Android:id to @android:id/tabcontent
Android's Tabhost