安卓解决碎片问题,fragment so easy
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
//int pagerPosition = savedInstanceState == null ? 0 : savedInstanceState.getInt(STATE_POSITION);
View view = inflater.inflate(R.layout.fragment_item_list, container, false);
pager = (ViewPager) view.findViewById(R.id.pager);
frList = new ArrayList<Fragment>();
Fragment deal = new DealBillFragment();
Fragment undeal = new UndealBillFragment();
frList.add(deal);
frList.add(undeal);
mAdapter = new MyPagerAdapter(getChildFragmentManager(),frList);
pager.setAdapter(mAdapter);
pager.setCurrentItem(0);
return view; |
|