如何使用Fragment代替TabActivity-Android开发问答
1个回答
展开全部
viewpage来装载,
FragmentActivity来替换tabactivity
类似以下:
List<Fragment> views = new ArrayList<Fragment>();
BusinessHandleFragment flow=new BusinessHandleFragment(1); //流量业务
BusinessHandleFragment flow1=new BusinessHandleFragment(2);//品转业务
BusinessHandleFragment flow2=new BusinessHandleFragment(3);//基础业务
BusinessHandleFragment flow3=new BusinessHandleFragment(4);//其他业务
views.add(flow);
views.add(flow1);
views.add(flow2);
views.add(flow3);
MyViewPagerAdapter pAdapter = new MyViewPagerAdapter(getSupportFragmentManager(), views);
mPager.setAdapter(pAdapter);
FragmentActivity来替换tabactivity
类似以下:
List<Fragment> views = new ArrayList<Fragment>();
BusinessHandleFragment flow=new BusinessHandleFragment(1); //流量业务
BusinessHandleFragment flow1=new BusinessHandleFragment(2);//品转业务
BusinessHandleFragment flow2=new BusinessHandleFragment(3);//基础业务
BusinessHandleFragment flow3=new BusinessHandleFragment(4);//其他业务
views.add(flow);
views.add(flow1);
views.add(flow2);
views.add(flow3);
MyViewPagerAdapter pAdapter = new MyViewPagerAdapter(getSupportFragmentManager(), views);
mPager.setAdapter(pAdapter);
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询