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
在使用过程中发现,底部的indicator在滑动到最后一页时,底部的indicator的标记展示在倒数第二个上,经过查找代码,发现是在BasePageIndicator的recyclerView的OnScrollListener的事件处理的问题,代码如下: if (newState == RecyclerView.SCROLL_STATE_IDLE) { LayoutManager layoutManager = recyclerView.getLayoutManager(); int position = 0; if (layoutManager instanceof GridLayoutManager) { GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager; position = gridLayoutManager.findFirstVisibleItemPosition(); //这句代码的问题 int row = gridLayoutManager.getSpanCount(); position = position / (row * mPageColumn); } else if (layoutManager instanceof LinearLayoutManager) { LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager; position = linearLayoutManager.findFirstVisibleItemPosition(); } onPageSelected(position); } 经过测试,发现在gridLayoutManager.findFirstVisibleItemPosition()在获取最后一页的第一个显示的item时的位置是错误的,比正确的position少了2,将该行代码修改如下,以上问题得到解决: position = gridLayoutManager.findFirstCompletelyVisibleItemPosition(); 修改后,得到的position的位置正确,以上问题得到解决。
The text was updated successfully, but these errors were encountered:
@EdwinSmartBoy 赞,确实没注意
Sorry, something went wrong.
能实现点击按钮进行页面的切换吗?
还有一个关于indicator的问题,因为indicator的切换是在SCROLL_STATE_IDLE时,如果连续滑动好几个page(例如从第一页到第四页),这中间indicator一直指示的是第一页,直到第四页SCROLL_STATE_IDLE时,indicator直接切换第四页对应的位置
No branches or pull requests
在使用过程中发现,底部的indicator在滑动到最后一页时,底部的indicator的标记展示在倒数第二个上,经过查找代码,发现是在BasePageIndicator的recyclerView的OnScrollListener的事件处理的问题,代码如下:
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
LayoutManager layoutManager = recyclerView.getLayoutManager();
int position = 0;
if (layoutManager instanceof GridLayoutManager) {
GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
position = gridLayoutManager.findFirstVisibleItemPosition(); //这句代码的问题
int row = gridLayoutManager.getSpanCount();
position = position / (row * mPageColumn);
} else if (layoutManager instanceof LinearLayoutManager) {
LinearLayoutManager linearLayoutManager = (LinearLayoutManager) layoutManager;
position = linearLayoutManager.findFirstVisibleItemPosition();
}
onPageSelected(position);
}
经过测试,发现在gridLayoutManager.findFirstVisibleItemPosition()在获取最后一页的第一个显示的item时的位置是错误的,比正确的position少了2,将该行代码修改如下,以上问题得到解决:
position = gridLayoutManager.findFirstCompletelyVisibleItemPosition();
修改后,得到的position的位置正确,以上问题得到解决。
The text was updated successfully, but these errors were encountered: