Question

Hi Friends i want to create tab's in project. For making tab there is two way which i found

1) Extends the activity class with TabActivity class which is deprecated as i seem this is a easy way but don't why it is deprecated so i want to know whether any other class or any alternative for that class.

2) Create individual activity for every tab which lengthy but convenient way but still feels TabActivity is fast one.

I was wondering if anybody could tell me, Thanks

Was it helpful?

Solution

For making tab there is two way which i found

You can also:

  • Use a ViewPager with a tabbed indicator, such as PagerTabStrip, the TabPagerIndicator from the ViewPagerIndicator project, PagerSlidingTabStrip, etc.

  • Use tabs in the action bar (note: these will convert into a drop-down list in some device sizes and orientations)

  • Use FragmentTabHost

  • Use TabHost and TabWidget in a regular Activity

The following sample projects demonstrate:

Note that the first three samples all use ActionBarSherlock, so they run on Android 2.x devices. The fourth one should run on anything from Android 1.0 onwards.

OTHER TIPS

use Fragments as an alternative of TabActivity . To get a feel like Tabs you can do this. Use a FragmentActivity. Add different Fragments in it. And use ViewPager to switch between different fragments.

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