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);
}
}
posted @ 2017-10-24 16:56  dub  阅读(341)  评论(0编辑  收藏  举报