Skip to content
New issue

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

轮播图放在recycleView首个item,刷新recyclerView时 如轮播图正在滚动时导致IndexOutOfBoundsException #1047

Closed
JSONGKING opened this issue Jun 22, 2021 · 5 comments

Comments

@JSONGKING
Copy link

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionImageHolder{57b739d position=2 id=-1, oldPos=-1, pLpos:-1 no parent} androidx.viewpager2.widget.ViewPager2$RecyclerViewImpl{b384012 VFED..... ........ 0,0-672,360 #8}, adapter:com.snail.card.home.adapter.ImageAdapter@a64f3e3, layout:com.youth.banner.util.ScrollSpeedManger@3dd31e0, context:com.snail.card.MainAct@470b42b

@liyujiang-gzu
Copy link

java.lang.IndexOutOfBoundsException: Inconsistency detected这个问题的相关issues已经有五六条了

@liyujiang-gzu
Copy link

@youth5201314

我也出现了这个问题,希望能在源码ScrollSpeedManger复写一下
@OverRide
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
try {
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
}
try/catch掉这个问题,
毕竟目前还没有更好的方法,另外一个方法是刷新状态时设置banner不可滑动关闭自动滑动

@mayer500
Copy link

mayer500 commented Jul 4, 2022

@youth5201314

我也出现了这个问题,希望能在源码ScrollSpeedManger复写一下
@OverRide
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
try {
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
}
try/catch掉这个问题,
毕竟目前还没有更好的方法,另外一个方法是刷新状态时设置banner不可滑动关闭自动滑动

你是下载源码,修改源码的? 还是通过asm去修改的

@liyujiang-gzu
Copy link

@youth5201314

我也出现了这个问题,希望能在源码ScrollSpeedManger复写一下
@OverRide
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
try {
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
}
try/catch掉这个问题,
毕竟目前还没有更好的方法,另外一个方法是刷新状态时设置banner不可滑动关闭自动滑动

你是下载源码,修改源码的? 还是通过asm去修改的

继承啊:XXX extends ScrollSpeedManger,然后 setLayoutManager(XXX)

@pengxiyang
Copy link

我试了,依然闪退,所以我采用了清除数据就刷新界面的方法#1195 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants