以下编码,只有第一个fragment里的刷新组件能触发,其他四个都不行
RefreshLayout refreshLayout = getActivity().findViewById(R.id.refreshLayout);
DebugLogUtil.getInstance().Debug("测试 .." + refreshLayout.toString());
refreshLayout.setRefreshHeader(new ClassicsHeader(getContext()));
refreshLayout.setRefreshFooter(new ClassicsFooter(getContext()));
refreshLayout.setEnableLoadMoreWhenContentNotFull(false);
refreshLayout.setOnRefreshListener(refreshlayout -> {
page = 1;
list = new ArrayList<>();
req();
refreshlayout.finishRefresh(1000/*,false*/);//传入false表示刷新失败
});
ticketFrag = new OrderFrag(0);
ticketFrag1 = new Order1Frag(1);
ticketFrag2 = new Order2Frag(2);
ticketFrag3 = new Order3Frag(3);
ticketFrag4 = new Order4Frag(4);
fragmentList.add(ticketFrag);
fragmentList.add(ticketFrag1);
fragmentList.add(ticketFrag2);
fragmentList.add(ticketFrag3);
fragmentList.add(ticketFrag4);
// mPagerAdapter.addFragment(ticketFrag);
// mPagerAdapter.addFragment(ticketFrag1);
// mPagerAdapter.addFragment(ticketFrag2);
// mPagerAdapter.addFragment(ticketFrag3);
// mPagerAdapter.addFragment(ticketFrag4);
String[] title = {"全部", "待付款", "待发货", "待收货", "待评价"};
adapter = new MyPagerAdapter(getSupportFragmentManager(), fragmentList, title);
viewPager.setAdapter(adapter);
mTabLayout.setupWithViewPager(viewPager);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…