-
-
Notifications
You must be signed in to change notification settings - Fork 444
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
控件缩小的问题 #308
Comments
同样遇到这个问题,出现是refreshData()之后setCurrentItem |
有解决吗 |
用 create(item.list) 去刷新数据,解决了 |
这样不算解决 |
这其实是recyclerview的瓜,viewpager2 如果应用了缩放也存在类似的问题,当你刷新的时候,list通常是这样的: list.clear();
list.addAll(newDataList);
adapter.notifyDataSetChange(); 咋一看没啥问题,的确,一般的界面recycleView是不会存在问题的。但当你原本的界面存在缩放item时,recyclerView会因为缓存,导致错乱。 list.clear();
notifyItemRangeRemoved(0, list.size);
list.addAll(newDataList);
// notifyItemRangeInserted(0, list.size)
adapter.notifyDataSetChange(); 但这么做,也可能带来新的问题,就是刷新闪现,因为缓存无了,加上动画闪现。 当然,还有直接替换adapter或嘎一个新的recyclerview应该也是可以的 |
用了这个bannerview ,app一进来先正常显示然后又缩小,变成这个样子,你们遇到过吗?然后手动滑动又正常了,下次进来都正常。
代码如下:
parkCardBanner.setLifecycleRegistry(getLifecycle()).setAdapter(vehicleAdapter).setAutoPlay(false).setInterval(2000).setPageMargin(5).setRevealWidth(5).setIndicatorVisibility(View.GONE).setIndicatorView(indicatorViewHome)
// .setIndicatorSlideMode(IndicatorSlideMode.COLOR)
.setPageStyle(PageStyle.MULTI_PAGE_SCALE);
The text was updated successfully, but these errors were encountered: