Namespace: Android.widget.TabHost initialization function (must be called before AddTab): Setup (); Contains two sub-elements: 1.Tab label container tabwidget (@android: id/tabs) 2.Tab content container Framelayout (@android: id/tabcontent)FragmenttabhostNamespace: Android.support.v4.app.FragmentTabHost android.support.v13.app.FragmentTabHost initialization function (must be called before AddTab) : Setup (this, Getsupportfragmentmanager (), r.id.realtabcontent); Contains three sub-elements: 1.Tab label container tabwidget (@android: id/tabs) 2.Tab content Container Framelayout [w/h 0DP] (@android: id/tabcontent) 3.Tab content Container framelayout [real container] (@+id/realtabcontent)Questions:Why are there tabcontent and realtabcontent two framelayout at the same time? FAQ: "Tabwidget can't move to the bottom of the screen in Fragmenttabhost" http://blog.csdn.net/wklbeta/article/details/11329207Information: "Android Development: Using fragment to transform Tabactivity" http://www.blogjava.net/amplifier/archive/2012/12/27/393409.htmlExperience-several ways to implement the TAB function:1. (obsolete) inherit from tabactivity + tabhost layout + Activity content1.1:tabactivity for activitygroup[in version 13] Subclass 1.2: Using Gettabhost () to get Tabhost Object 1.3: Using Newtabspec (...). SetContent (Intent) Add tab tags and content2. (obsolete) inherit from Activitygroup + tabhost layout + Activity content2.1:activitygroup was abandoned in version 13 2.2: Using Findviewbyid to get Tabhost object 2.3: Using Setup (New Localactivitymana GER (this, true)) initialization 2.4: Use Newtabspec (...). SetContent (Intent) Add tab tags and content3. (simple) inherit from fragmentactivity + fragmenttabhost layout + Fragment content3.1: Get Fragmenttabhost object using Findviewbyid 3.2: Using Setup (this, Getsupportfragmentmanager (), r.id.realtabcontent) Initialization 3.3: Use AddTab (Newtabspec (). Setindicator (), fragment.class, NULL) to add tab tags and content4. (complex) inherit from fragmentactivity + tabhost layout + viewpager layout + Fragment content4.1: Using Findviewbyid to get Tabhost object 4.2: Using setup () initialization 4.3: Using Tabhost.addtab (Tabspec.setcontent (Dum Mytabfactory)); Add tab tags andEmpty Content4.4: Control Viewpager's actual display in tabhost.ontabchanged 4.5: Control tab TAB Selection in viewpager.onpageselected when sliding.PS: The Tabhost layout here is somewhat superfluous when the number of tabs is fixed and the label effect is not pursued and the system remains consistent. For example, if the tab tag is fixed for a particular application and has its own set of display effects, there is no need to tabhost the layout at all. 5. (DIY) inherit from fragmentactivity + custom layout + viewpager layout + Fragment content5.1: Embed fixed tab element in custom layout 5.2: Control the actual display of Viewpager in the tag element Click event 5.3: Control the tag element in viewpager.onpageselected when sliding The choice of the vegetarian.
Http://www.cnblogs.com/asion/archive/2013/09/25/3339313.html
Android Learning notes: Tabhost and Fragmenttabhost