ogaclejapan / SmartTabLayout

A custom ViewPager title strip which gives continuous feedback to the user when scrolling
Apache License 2.0
7.09k stars 1.34k forks source link

How to add a page dynamically, such as a new page by clicking the + button #178

Open 401885064 opened 8 years ago

401885064 commented 8 years ago

How to add a page dynamically, such as a new page by clicking the + button

tokgocode commented 8 years ago

viewPagers = FragmentPagerItems.with(this).add("MyFragment 1", MyFragment.class).create(); viewPagerAdapter = new FragmentPagerItemAdapter(getSupportFragmentManager(), viewPagers); viewPager.setAdapter(viewPagerAdapter); stlTabs.setViewPager(viewPager);

viewPagers.add(FragmentPagerItem.of("MyFragment 2", MyFragment.class)); viewPagerAdapter.notifyDataSetChanged(); stlTabs.setViewPager(viewPager);