Closed phuanh004 closed 8 years ago
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter( getSupportFragmentManager(), FragmentPagerItems.with(this) .add(R.string.titleA, PageFragment.class) .add(R.string.titleB, PageFragment.class) .create()); ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); viewPager.setAdapter(adapter); SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab); viewPagerTab.setViewPager(viewPager);
And I want
FragmentPagerItemAdapter adapter = new FragmentPagerItemAdapter( getSupportFragmentManager(), FragmentPagerItems.with(this) .create()); ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); ... onPostExcute(){ for(int i=0;i<10;i++){ adapter.add("Page "+i, PageFragment.class); } // How can I do this ? ... viewPager.setAdapter(adapter); SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab); viewPagerTab.setViewPager(viewPager); }
Hi, @phuanh004
Please refer to the demo. https://github.com/ogaclejapan/SmartTabLayout/blob/master/demo/src/main/java/com/ogaclejapan/smarttablayout/demo/DemoActivity.java#L46-L55
And I want