use of com.example.jingbin.cloudreader.ui.gank.GankFragment in project CloudReader by youlookwhat.
the class MainActivity method initContentFragment.
private void initContentFragment() {
ArrayList<Fragment> mFragmentList = new ArrayList<>();
mFragmentList.add(new GankFragment());
mFragmentList.add(new OneFragment());
mFragmentList.add(new BookFragment());
// 注意使用的是:getSupportFragmentManager
MyFragmentPagerAdapter adapter = new MyFragmentPagerAdapter(getSupportFragmentManager(), mFragmentList);
vpContent.setAdapter(adapter);
// 设置ViewPager最大缓存的页面个数(cpu消耗少)
vpContent.setOffscreenPageLimit(2);
vpContent.addOnPageChangeListener(this);
mBinding.include.ivTitleGank.setSelected(true);
vpContent.setCurrentItem(0);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
//去除默认Title显示
actionBar.setDisplayShowTitleEnabled(false);
}
}
Aggregations