FragmentStatePagerAdapter写法
为了节省资源,分批加载数据
//适配器
class TabLayoutViewPagerAdapter extends FragmentStatePagerAdapter {
public TabLayoutViewPagerAdapter(FragmentManager fm) {
super(fm);
}
@Override
public int getItemPosition(Object object) {
return POSITION_NONE;
}
@Override
public Fragment getItem(int position) {
return fragmentList.get(position);
}
@Override
public int getCount() {
return fragmentList.size();
}
@Override
public CharSequence getPageTitle(int position) {
return titles.get(position);
}
}