use of me.yokeyword.sample.demo_flow.adapter.DiscoverFragmentAdapter in project Fragmentation by YoKeyword.
the class DiscoverFragment method initView.
private void initView(View view) {
Toolbar mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
TabLayout mTabLayout = (TabLayout) view.findViewById(R.id.tab_layout);
ViewPager mViewPager = (ViewPager) view.findViewById(R.id.viewPager);
mToolbar.setTitle("发现");
initToolbarNav(mToolbar);
mTabLayout.addTab(mTabLayout.newTab().setText(R.string.recommend));
mTabLayout.addTab(mTabLayout.newTab().setText(R.string.hot));
mTabLayout.addTab(mTabLayout.newTab().setText(R.string.favorite));
mViewPager.setAdapter(new DiscoverFragmentAdapter(getChildFragmentManager()));
mTabLayout.setupWithViewPager(mViewPager);
}
Aggregations