How to put a layout into each tab page?
The generated code creates a ViewPager
in the layout file and wires up action bar tabs to the pages in that ViewPager
. Personally I'd rather use a PagerTabStrip
, or possibly one of the ViewPagerIndicator equivalents, but they didn't ask me... :-)
Regardless, to fill in the pages, you need to replace (or complete) the SectionsPagerAdapter
and/or DummySectionFragment
inner classes of the generated activity. Right now, this is set up to have three pages, each of which is merely a TextView
. But, you could have DummySectionFragment
inflate a layout instead, and if you are looking for different layouts per tab, you would probably create separate Fragment
implementations per layout/tab combination. You would then teach SectionsPagerAdapter
how many pages you want (getCount()
) and what to use for each page (getItem()
) and what each tab caption is (getPageTitle()
).