Last active
April 18, 2018 06:29
ViewPagerFragment
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 { | |
public ViewPagerAdapter(FragmentManager fm) { | |
super(fm); | |
} | |
@Override | |
public Fragment getItem(int position) { | |
switch (position) { | |
case 0: | |
return new Fragment1(); | |
case 1: | |
return new Fragment2(); | |
default: | |
return null; | |
} | |
} | |
//要切換的頁面數量 | |
@Override | |
public int getCount() { | |
return 2; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment