当前位置: 代码迷 >> Android >> 多个雷同布局的fragment切换
  详细解决方案

多个雷同布局的fragment切换

热度:99   发布时间:2016-04-28 05:55:07.0
多个相同布局的fragment切换
多个相同布局的fragment
但是这些fragment里面的内容都不同(里面有个listview,listview内容不同)
如何定义才不用新建多个fragment类
该如何实例化呢?
------解决方案--------------------
public static class PlaceholderFragment extends Fragment {
public static PlaceholderFragment newInstance(Bundle bundle) {
PlaceholderFragment fragment = new PlaceholderFragment();
/*处理bundle传过来的数据*/
return fragment;
}

private PlaceholderFragment() {
}
}
  相关解决方案