Fragment和Viewpager配合使用,实现左右滑动和每个分界面的分别显示和功能控制
主要代码片段:
mTabPager = (ViewPager)findViewById(R.id.tabpager);
fragmentsList = new ArrayList<Fragment>();
LayoutInflater mInflater = getLayoutInflater();
Fragment zhuye = new AllpeopleActivity();
Fragment address = new GroupActivity();
Fragment friend = new FriendActivity();
Fragment set=new SetActivity();
fragmentsList.add(zhuye);
fragmentsList.add(address);
fragmentsList.add(friend);
fragmentsList.add(set);
mTabPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), fragmentsList));
主要代码片段:
mTabPager = (ViewPager)findViewById(R.id.tabpager);
fragmentsList = new ArrayList<Fragment>();
LayoutInflater mInflater = getLayoutInflater();
Fragment zhuye = new AllpeopleActivity();
Fragment address = new GroupActivity();
Fragment friend = new FriendActivity();
Fragment set=new SetActivity();
fragmentsList.add(zhuye);
fragmentsList.add(address);
fragmentsList.add(friend);
fragmentsList.add(set);
mTabPager.setAdapter(new MyFragmentPagerAdapter(getSupportFragmentManager(), fragmentsList));