(一)添加Fragment界面
List<Fragment> fragmentList = new ArrayList<>();
fragmentList.add(InterViewListFragment.newInstance(0));
fragmentList.add(InterViewListFragment.newInstance(2));
(二)InterViewListFragment界面
public class InterViewListFragment extends BaseFragment implements View.OnClickListener {
private int mconts;
public static InterViewListFragment newInstance(int tag) {
Bundle args = new Bundle();
args.putInt(M_TAG, tag);
InterViewListFragment fragment = new InterViewListFragment();
fragment.setArguments(args);
return fragment;
}
@Override
protected int setLayout() {
return R.layout.fragment_list_interview;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mconts = getArguments().getInt(M_TAG, -1);
}
@Override
protected void initView(View root) {
listview = (PullToRefreshListView) root.findViewById(R.id.listview);
reload_text = (TextView) root.findViewById(R.id.reload_text);
reload = (Button) root.findViewById(R.id.reload);
if (mconts == 0) {
intent.putExtra("editable", true);
startActivity(intent);
} else if (mconts == 2) {
intent.putExtra("editable", false);
startActivity(intent);
}
}
}
Fragment在Viewpager中重用
最新推荐文章于 2018-07-28 20:19:21 发布