We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这个主要是由于isRecyclerViewTop此方法做判断时由于一些情况下顶部距离可能不为0时导致滑动可能不会触发向下滑动 所以需要固定配置,因人而异配置方法可能不同我的配置方法是: 加一个顶部偏移值
先修改这个HeaderScrollHelper类下的方法:
/** * 顶部偏移值,主要是给isRecyclerViewTop此方法做判断时由于一些情况下顶部距离可能不为0 所以需要固定配置 */ private int topOffsetHeight = 0;
修改滑动内容适配器:
public void setCurrentScrollableContainer(ScrollableContainer scrollableContainer, int topOffsetHeight) { this.mCurrentScrollableContainer = scrollableContainer; this.topOffsetHeight = topOffsetHeight; }
源方法isRecyclerViewTop改为这样:
private boolean isRecyclerViewTop(RecyclerView recyclerView) { if (recyclerView != null) { RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager(); if (layoutManager instanceof LinearLayoutManager) { int firstVisibleItemPosition = ((LinearLayoutManager) layoutManager).findFirstVisibleItemPosition(); View childAt = recyclerView.getChildAt(0); RecyclerView.ItemDecoration itemDecoration = recyclerView.getItemDecorationAt(0); if (childAt == null || (firstVisibleItemPosition == 0 && (childAt.getTop() == topOffsetHeight || childAt.getTop() == 0))) { return true; } } } return false; }
然后是修改此HeaderViewPager类下的方法(我修改了一个方法并且加了一个方法):
public void setCurrentScrollableContainer(HeaderScrollHelper.ScrollableContainer scrollableContainer, int topOffset) { mScrollable.setCurrentScrollableContainer(scrollableContainer, topOffset); } public void setCurrentScrollableContainer(HeaderScrollHelper.ScrollableContainer scrollableContainer) { mScrollable.setCurrentScrollableContainer(scrollableContainer, 0); }
然后就是特例的一些界面特例处理
headerViewPager.setCurrentScrollableContainer((HeaderViewPagerFragment) fragmentList.get(position), DensityUtil.dip2px(CustomerDetailActivity.this, 30)); } else { headerViewPager.setCurrentScrollableContainer((HeaderViewPagerFragment) fragmentList.get(position)); }
至此应该能解决大部分问题了
The text was updated successfully, but these errors were encountered:
最后那个界面特殊处理 if else 是什么条件啊
Sorry, something went wrong.
RecyclerView.ItemDecoration itemDecoration = recyclerView.getItemDecorationAt(0); 为什么要加这句 也没有用到这个itemDecoration啊 运行的时候会报错越界 还有顶部偏移值是置顶tab离顶部导航栏的距离吗?像我最顶部有一个搜索框不在HeaderViewPager里 是设为搜索框的高度吗?麻烦看到能帮忙解答下 谢谢
No branches or pull requests
这个主要是由于isRecyclerViewTop此方法做判断时由于一些情况下顶部距离可能不为0时导致滑动可能不会触发向下滑动 所以需要固定配置,因人而异配置方法可能不同我的配置方法是:
加一个顶部偏移值
先修改这个HeaderScrollHelper类下的方法:
修改滑动内容适配器:
源方法isRecyclerViewTop改为这样:
然后是修改此HeaderViewPager类下的方法(我修改了一个方法并且加了一个方法):
然后就是特例的一些界面特例处理
至此应该能解决大部分问题了
The text was updated successfully, but these errors were encountered: