完全像我的APP做...
对于更改ViewPagerAdapter,我所做的是:
清除当前适配器内的所有片段
将当前适配器设置为null
为ViewPager分配新的adpater
/* Clear all Fragments inside current adapter */
public class MyPagerAdapter extends FragmentPagerAdapter
{
private ArrayList fragments=new ArrayList();
//...some stuff
public void clearAll() //Clear all page
{
for(int i=0; i
fragMan.beginTransaction().remove(fragments.get(i)).commit();
fragments.clear();
}
}
/* Set current adapter to null */
Constants.VP.removeAllViews();
Constants.VP.setAdapter(null);
/* Assign new adpater for ViewPager */
Constants.PAGER=new MyewPagerAdapter(getSupportFragmentManager());
Constants.VP.setAdapter(Constants.PAGER);
希望它有所帮助〜