Search code examples
androidfragmentpagerslidingtabstrip

How to load second tab by default when using PagerSlidingTabStrip in android


I need to create a UI just like below.

enter image description here

When I write the code and run the application, it loads first tab which is "Categories". What I need is to load second tab, which is "Home" when I run the application without changing the Tab order.

Below is my code.


Solution

  • It doesn't matter if it's PagerSlidingTabStrip or another, what you need is to set the current item of your viewpager :

    setCurrentItem(int item)
    

    Set the currently selected page.