How to create Tablayout correctly now that Tabactivity is out of date?

TabActivity has been deprecated since fragments appeared.

At the same time, the TabLayout Hello Views tutorial still uses TabActivity, and there is no clear answer in the API documentation on how to create a tab layout with fragments instead of TabActivity.

How do you build Tablayouts now that TabActivity is deprecated?

+8
android android-fragments android-tabactivity
source share
3 answers

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, like on any latest version of Android (2.x)

0
source share

Well, I had this problem, and here is an example solution for FragmentTabs.java . But I'm still waiting for the solution that Fragments provides instead of using an ActivityGroup .

0
source share

Use TabHost or ActionBar with a tab along with Fragments .

I recommend that you use a tabbed ActionBar and a ViewPager to store snippets for each tab.

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

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

Also check out this example . Good luck

0
source share

All Articles