Question

Since the introduction of Fragments the TabActivity is deprecated.

The Hello Views TabLayout Tutorial however still uses the TabActivity and the API-Documentation has no clear answer on how to create a Tab Layout with Fragments instead of a TabActivity.

How are you building Tablayouts now that the TabActivity is deprecated?

Was it helpful?

Solution 3

Since the release of ActionBarSherlock there is no need to use the old tap API. Just use the new tabs with fragments in any way you like on any recent Android Version (2.x)

OTHER TIPS

Well, I had that issue and here is the solution example for that FragmentTabs.java. But I am still awaiting for the solution that Fragments provides instead of using ActivityGroup.

Use TabHost or ActionBar with tabs along with Fragments .

I recommend you to use ActionBar with tabs and a ViewPager to hold the fragments for each tabs.

in onPageSelected() of onPageChangeListener, set the current tab by getActionBar().setSelectedNavigationItem(position);

and in onTabSelected(Tab tab, FragmentTransaction ft) of TabListener set the current page in viewpager by mViewPager.setCurrentItem(tab.getPosition());

Check this example too. Good Luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top