Difference between tabActivity and tabhost and Layout tab

What is the difference between tabActivity and tabhost and tabLayout in android ?

My Layout should have five Tab . Which one is best to use?

+7
android
source share
4 answers

TabActivity deprecated. Instead, you should use Fragments and FragmentManager. TabHost and TabWidget simply define part of the screen for tabs and tab content. There are ways to use them with TabActivity , but this is not necessary. Note that there is now a FragmentTabHost class, which you can also consider.

If you want these tabs to actually be in the same Activity and have the ability to scroll between them, you can also consider using ViewPager with PagerTabStrip top: https://developer.android.com/training/implementing-navigation/lateral .html

+1
source share

Try this way, hope it helps you solve your problem

As we know, Tab-Activity is now depreciating in Android, but for a while we use it to create simple tab pages in our application. So these days we are using Host Activity in android

Android has many layouts available to the developer to present maximum functionality with a vibrant user interface (UI). The Layout tab is also one of them. There are several tabs in the tab layout that contain one activity on each tab. Simply, the user will receive four actions in only one event containing tabs. The current activity in the tab layout will appear according to the pressed tab. This section will focus on setting the layout of the tab.

We mainly used: -

 1. TabHost 2. TabWidget 3. TabHost.TabSpec 4. FrameLayout 5. Intent 

You must use tabHost to create tabs.

Here you can find more here. Thanks

+1
source share

TabActivity Depricated

This class is deprecated at API level 13. New applications should use Fragments instead of this class; to continue working on older devices> you can use the v4 support library, which provides a fragment API version that is compatible with s> up to DONUT.


Tabhost

Tabbed window container. This object contains two children: a set of tab shortcuts that the user clicks to select a specific tab, and a FrameLayout object that displays the contents of this page. Individual elements are usually managed using this container object, and not> set values โ€‹โ€‹for the child elements themselves.


Use snippets to create tabs

Here is a good tutorial to get you started - Check out this link - Click here

+1
source share

All Articles