Just comparing the visuals...
TabLayout
is a material concept that replaced the deprecated ActionBar tabs in Android 5.0.
It extends HorizontalScrollView
, so you can keep adding tabs horizontally which can include text, icons, or custom views and scroll through them linearly without paging.
TabLayout
provides the setupWithViewPager(ViewPager viewPager)
method to attach to a ViewPager
instead of being part of the ViewPager
like the PagerTabStrip
.
A PagerTabStrip
is more of an indictor for the current page of a ViewPager, and "it is intended to be used as a child view of a ViewPager widget". The scrolling for it does not act like the TabLayout
since each tab is part of the page instead of individually horizontally scrollable.
In summary, the differences are (apart from visuals).
- A
TabLayout
is part of the Activity/Fragment, outside of the ViewPager
, and you instead attach it to one. It scrolls separately from the pages.
- A
PagerTabStrip
is a child element of the ViewPager
. The tabs scroll with the page.