当片段第一次呈现其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();
}
});