Last active
March 24, 2016 05:32
-
-
Save ccjeng/43bac67a1a149ea6eb60 to your computer and use it in GitHub Desktop.
Android TabLayout ViewPagerAdapter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ViewPagerAdapter extends FragmentPagerAdapter { | |
private final String[] tabTitles = { "Tab1", "Tab2", "Tab3" }; | |
public ViewPagerAdapter(FragmentManager fm) { | |
super(fm); | |
} | |
@Override | |
public CharSequence getPageTitle(int position) { | |
return tabTitles[position]; | |
} | |
@Override | |
public int getCount() { | |
return tabTitles.length; | |
} | |
@Override | |
public Fragment getItem(int position) { | |
return TabFragment.newInstance(position); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment