recyclelerView scrollListener使用oncreateView调用触发器

时间:2018-05-13 11:47:35

标签: java android android-recyclerview onscrolllistener

当片段第一次呈现其recyclelerview的调用滚动监听器导致错误时,这是​​我的代码

 viewPagerDetail.setOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {


            int tab= linearVertical.findFirstCompletelyVisibleItemPosition();
            if (tab>=0 && tab < tabLayoutDetail.getTabCount()) {
                tabLayoutDetail.getTabAt(tab).select();
            }

            viewPagerDetail.getAdapter().notifyDataSetChanged();

        }
    });

0 个答案:

没有答案