Android 12 Developer Preview is here! Try it out, and give us your feedback!

TabLayout.TabLayoutOnPageChangeListener

public static class TabLayout.TabLayoutOnPageChangeListener
extends Object implements ViewPager.OnPageChangeListener

java.lang.Object
   ↳ com.google.android.material.tabs.TabLayout.TabLayoutOnPageChangeListener


A ViewPager.OnPageChangeListener class which contains the necessary calls back to the provided TabLayout so that the tab position is kept in sync.

This class stores the provided TabLayout weakly, meaning that you can use addOnPageChangeListener(OnPageChangeListener) without removing the listener and not cause a leak.

Summary

Public constructors

TabLayoutOnPageChangeListener(TabLayout tabLayout)

Public methods

void onPageScrollStateChanged(int state)
void onPageScrolled(int position, float positionOffset, int positionOffsetPixels)
void onPageSelected(int position)

Inherited methods

Public constructors

TabLayoutOnPageChangeListener

public TabLayoutOnPageChangeListener (TabLayout tabLayout)

Parameters
tabLayout TabLayout

Public methods

onPageScrollStateChanged

public void onPageScrollStateChanged (int state)

Parameters
state int

onPageScrolled

public void onPageScrolled (int position, 
                float positionOffset, 
                int positionOffsetPixels)

Parameters
position int

positionOffset float

positionOffsetPixels int

onPageSelected

public void onPageSelected (int position)

Parameters
position int