Listview标题滞后直到滚动

时间:2014-03-04 16:10:20

标签: android

我的listview的标题非常复杂。它是一个包含5个片段的ViewPager / FragmentStatePagerAdapter。奇怪的是,当视图首次加载时,整个列表视图都是滞后的。滚动浏览标题后,即使向后滚动到标题,列表视图也会变得平滑。关于可能发生的事情的任何想法?感谢您提供任何信息

包含ListView的片段

   @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View featuredView = inflater.inflate(R.layout.fragment_featured_series, container, false);
    ButterKnife.inject(this, featuredView);        
    View headerView = getHeaderView()
    featuredList.addHeaderView(featuredListHeaderView);
    sAdapter = new SeriesAdapter(getActivity(), new ArrayList<SeriesItem>());
    featuredList.setAdapter(sAdapter);
    return featuredView;
}

 RelativeLayout getHeaderView() {      
        featuredListHeaderView = new FeaturedListHeaderView(getActivity(), this, rHeight, recentHeight);
        featuredListHeaderView.setLayoutParams(params);
        featuredListHeaderView.setVisibility(View.INVISIBLE);
        return featuredListHeaderView;
    }
}

标题包含一个包含寻呼机的片段

    ...

    pagerAdapter = new FeaturedPagerAdapter(getActivity().getSupportFragmentManager(), new ArrayList<SeriesItem>());
    viewPager.setAdapter(pagerAdapter);
    pageIndicator.setViewPager(viewPager);

 private class FeaturedPagerAdapter extends FragmentStatePagerAdapter {

    private List<SeriesItem> seriesItems = new ArrayList<SeriesItem>();

    public FeaturedPagerAdapter(FragmentManager fm, List<SeriesItem> sItems) {
        super(fm);
        this.seriesItems = sItems;
    }

    @Override
    public Fragment getItem(int i) {
        FeaturedPageFragment pf = new FeaturedPageFragment(seriesItems.get(i));
        return pf;
    }

    @Override
    public int getCount() {
        return seriesItems.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return seriesItems.get(position).getName();
    }

    public void setItems(List<SeriesItem> items) {
        this.seriesItems = items;
        notifyDataSetChanged();
        pageIndicator.notifyDataSetChanged();
    }
}

FeaturedPageFragment只包含带有一些点击侦听器的图像

0 个答案:

没有答案