1、HomeFragment 在mainActivty 中调用;
2、HomeFragment 中:
private ArrayList<Fragment> mFragments = new ArrayList<>();
@Override
public void initData() {
for (String title : mTitles) {
mFragments.add(SimpleCardFragment.getInstance(title));
}
mAdapter = new MyPagerAdapter(getChildFragmentManager());
view_pager.setAdapter(mAdapter);
sliding_tab_layout.setViewPager(view_pager);
// sliding_tab_layout.setViewPager(view_pager, mTitles, getActivity(), mFragments);
// view_pager.setCurrentItem(4);
}
3、SimpleCardFragment 中:
tbkGoodsListAdapter = new TbkGoodsListAdapter(getActivity(),(ArrayList) tbkItemArrayList); mainPullRefreshView.getRecyclerView().setAdapter(tbkGoodsListAdapter);
4、 TbkGoodsListAdapter 中:
@NonNull @Override public TbkGoodsListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.recycler_item_coupon, viewGroup, false); return new ViewHolder(view); }