With the old SwipeyTabs you could just simply use the onSwipeyTabSelected.onSwipeyTabSelected, now android released at june 2012 the PageTabStrip, which it is supossed to ease the work, and in fact it does for simple cases. But i haven’t found any method that in fact allows me to detect the Selection of a tab, in example:
_______________________________
| |Tab1| Tab2|
_______________________________
if i swipe to the right and the Tab2 got selected:
_______________________________
|Tab1 |Tab2| Tab3|
_______________________________
How can i detect/trigger an event in my activity containing the PagerTabStrip that this tab was selected?
P.S. Forgive me the crappy ascii art 😀
Since your
PagerTabStripis tied to aViewPager, and changes the contents of theViewPager, you can register aViewPager.OnPageChangeListenerto theViewPagerviasetOnPageChangeListener().If your argument is “well, I want to do different things if they swipe via the tabs than if they swipe the body of the pager”, then I’m not a fan of that UX.