//RecyclerView和tab栏联动
mLv.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
mTab.setTabSelected(manager.findFirstVisibleItemPosition());
}
});
//tab栏和RecyclerView联动
mTab.addOnTabSelectedListener(new VerticalTabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabView tab, int position) {
manager.scrollToPositionWithOffset(position,0);
}
@Override
public void onTabReselected(TabView tab, int position) {
}
});
网友评论