1 private View mCurrentView; 2 3 @Override 4 public void setPrimaryItem(ViewGroup container, int position, Object object) { 5 mCurrentView = (View)object; 6 } 7 8 public View getPrimaryItem() { 9 return mCurrentView; 10 }
ViewPager的adapter通过setPrimaryItem方法设置当前显示子view.
将其保存下来可作后续应用。