标签:undle body stat his lob 静态 argument 拓展 container
String[] titles = { GlobalConfig.CATEGORY_NAME_APP, GlobalConfig.CATEGORY_NAME_ANDROID, GlobalConfig.CATEGORY_NAME_IOS, GlobalConfig.CATEGORY_NAME_FRONT_END, GlobalConfig.CATEGORY_NAME_RECOMMEND, GlobalConfig.CATEGORY_NAME_RESOURCE}; CommonViewPagerAdapter infoPagerAdapter = new CommonViewPagerAdapter(getSupportFragmentManager(),titles); // App CategoryFragment appFragment = CategoryFragment.newInstance(titles[0]); // Android CategoryFragment androidFragment = CategoryFragment.newInstance(titles[1]); // iOS CategoryFragment iOSFragment = CategoryFragment.newInstance(titles[2]); // 前端 CategoryFragment frontFragment = CategoryFragment.newInstance(titles[3]); // 瞎推荐 CategoryFragment referenceFragment = CategoryFragment.newInstance(titles[4]); // 拓展资源s CategoryFragment resFragment = CategoryFragment.newInstance(titles[5]); infoPagerAdapter.addFragment(appFragment); infoPagerAdapter.addFragment(androidFragment); infoPagerAdapter.addFragment(iOSFragment); infoPagerAdapter.addFragment(frontFragment); infoPagerAdapter.addFragment(referenceFragment); infoPagerAdapter.addFragment(resFragment);
public static CategoryFragment newInstance(String mCategoryName) { CategoryFragment categoryFragment = new CategoryFragment(); Bundle bundle = new Bundle(); bundle.putString(CATEGORY_NAME, mCategoryName); categoryFragment.setArguments(bundle); return categoryFragment; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_blank, container, false); ButterKnife.bind(this, view); //取出传过来的值 Bundle bundle = getArguments(); mTitle = bundle.getString(ARG_TITLE); return view; }
标签:undle body stat his lob 静态 argument 拓展 container
原文地址:https://www.cnblogs.com/ganchuanpu/p/11971341.html