public void setTabLayout(int position) { switch (position) { case 0: mFragmentMovie.setTabLayout(); break; case 1: mFragmentBook.setTabLayout(); break; case 2: mFragmentMine.setTabLayout(); break; } }
@Override public Fragment getItem(int position) { switch (position) { case 0: if (mFragmentMovie == null) mFragmentMovie = MovieFragment.newInstance(); return mFragmentMovie; case 1: if (mFragmentBook == null) mFragmentBook = BookFragment.newInstance(); return mFragmentBook; case 2: if (mFragmentMine == null) mFragmentMine = UserFragment.newInstance(); return mFragmentMine; } return null; }