In the demo Support4Demos – API 4+ Support Demos , the Tabs and TabsPager examples both extend FragmentActivity. Each tab content is itself a Fragment. No real breakthrough, TabActivity was used the same way without the introduction of Fragment.
Now suppose inside my Activity , a screen portion is a Fragment named WidgetFragment. How is it possible for WidgetFragment to contain a TabHost ? Visualize a mini TabHost contained inside an Activity.
I tried every possible way to insert a TabHost inside a Fragment not a FragmentActivity.
In generally accepted practices, Tabs fit the whole screen.
Most people (including me) are unaware the tabs can be placed anywhere like a simple view, ListView.
The trick is to include your TabHost inside another layout. When you create the TabHost, always keep these id : tabhost , tabs , tabcontent
In your main layout, include your tabhost.xml . Here I center the TabHost in the middle
Look well at the Tabs and TabsPager examples in Support4Demos , the TabHost is still managed by FragmentActivity. Each tab content is a fragment. With TabActivity, it may not be possible to have a tab anywhere
At the end, this is what it looks like