检测到不一致。无效的视图持有人适配器positionViewHolder ... android.support.v7.widget.RecyclerView

时间:2018-07-06 04:15:05

标签: android

https://drive.google.com/open?id=1hc2BsawKmRoXsLhAuBlhNFLx_9zlEiWC

我的应用活动包括可滚动的布局,viewpager和recyclerview。 第一次加载时,所有viewpager中的所有recyclerview都能顺利运行。 问题是,当我滚动第3或第4个viewpager recyclerview时,然后我滑动回到第2个viewpager,我只是触摸了recyclerview列表,它崩溃了。 请帮助我...

def FormatChart(chart):
    plot = chart.plots[0]
    plot.has_data_labels = True
    dl = plot.data_labels
    dl.position = XL_LABEL_POSITION.OUTSIDE_END

    value_axis = chart.value_axis
    value_axis.has_major_gridlines = False

    s = plot.series[0]
    s.format.fill.solid()
    s.format.fill.fore_color.theme_color = MSO_THEME_COLOR_INDEX.ACCENT_1

运行中的错误提示

    //Connect with tab and viewpager IN ACTIVITY
    TabLayout tabLayout =(TabLayout) findViewById(R.id.delivery_tabs);
    ViewPager viewPager =(ViewPager) findViewById(R.id.deliveryviewpager);
    tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);

    DeliveryTabsPager deliveryTabsPager = new DeliveryTabsPager(getSupportFragmentManager());

    viewPager.setAdapter(deliveryTabsPager);
    int page = getIntent().getIntExtra("One", defaultValue);
    viewPager.setCurrentItem(page);
    tabLayout.setupWithViewPager(viewPager);
    viewPager.setOffscreenPageLimit(4);


        //IN FRAGMENTS
        mLayoutManager = new LinearLayoutManager(getActivity());
        recyclerView.setLayoutManager(mLayoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        adapter = new DeliveryListAdapter(getActivity(), searchResults);
        recyclerView.setAdapter(adapter);


//ViewPagerAdapter
private String titles[]=new String[]{"OUT FOR DELIVERY","INCOMPLETE","COMPLETED","All"};

public DeliveryTabsPager(FragmentManager fm) {
    super(fm);
}

@Override
public CharSequence getPageTitle(int position){
    return titles[position];
}

@Override
public Fragment getItem(int position) {

    switch (position){

        case 0:
            OFDFragment ofdFragment = new OFDFragment();
            return ofdFragment;
        case 1:
            IncompleteFragment incompleteFragment = new IncompleteFragment();
            return incompleteFragment;
        case 2:
            CompletedFragment completedFragment = new CompletedFragment();
            return completedFragment;
        case 3:
            AllFragment allFragment = new AllFragment();
            return allFragment;
        default:
            return null;

    }
}

@Override
public int getCount() {
    return 4;
}


@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

}

@Override
public void onPageSelected(int position) {
    switch (position){
        case 0:
            OFDFragment ofdFragment = new OFDFragment();
        case 1:
            IncompleteFragment incompleteFragment = new IncompleteFragment();
        case 2:
            CompletedFragment completedFragment = new CompletedFragment();
        case 3:
            AllFragment allFragment = new AllFragment();
    }
}

@Override
public void onPageScrollStateChanged(int state) {

}

0 个答案:

没有答案