RecyclerView is scrolling to top, while user is scrolling down (bad anchorPosition?)
还没有人认领这个 Issue。
评估
调研方向
首先,在持续向下滚动的同时于 codelab 中重现该问题,然后检查 GithubRemoteMediator 的加载日志以及报告的 anchorPosition 变化。确定 anchorPosition 为何会从 81 回到 41,并验证滚动不再跳转到较早的元素。
由索引模型根据 Issue 内容生成。
描述
After continuously scrolling down, after a while RecyclerView is switching his position to some element which was before, resulting in not smooth displaying of elements in it.
I only change NETWORK_PAGE_SIZE to 20, and switch to latest versions of:
roomVersion = '2.4.3'
pagingVersion = '3.1.1'
I added logs to GithubRemoteMediator, when scrolling down, there is:
15:21:54.884 RemoteMediator D load, type: REFRESH, state.pages.size: 0, anchorPosition: null
15:21:55.935 RemoteMediator D load, type: PREPEND, state.pages.size: 1, anchorPosition: null
15:21:55.999 RemoteMediator D load, type: APPEND, state.pages.size: 1, anchorPosition: 3
15:21:56.918 RemoteMediator D load, type: APPEND, state.pages.size: 1, anchorPosition: 0
15:21:57.748 RemoteMediator D load, type: APPEND, state.pages.size: 1, anchorPosition: 0
15:22:02.064 RemoteMediator D load, type: APPEND, state.pages.size: 2, anchorPosition: 40
15:22:04.697 RemoteMediator D load, type: APPEND, state.pages.size: 2, anchorPosition: 30
15:22:08.322 RemoteMediator D load, type: APPEND, state.pages.size: 4, anchorPosition: 81
15:22:10.000 RemoteMediator D load, type: APPEND, state.pages.size: 2, anchorPosition: 41
As You can see, anchorPosition after element 81 is going to be 41, which result in RecyclerView most likely going to that element.
- 主要语言
- Kotlin
- 星标
- 508
- 派生
- 268
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
android/codelab-android-paging 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 62/100
android/codelab-android-paging#236 · 3 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 38/100
-
难度 2/5 1-3 小时 新手友好度 35/100
android/codelab-android-paging#243 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-2 天 新手友好度 35/100
android/codelab-android-paging#241 · 1 条评论 ·
查看 android/codelab-android-paging 的全部 Issue
相似的 Issue
-
copy design-review mac P3
难度 2/5 1-3 小时 新手友好度 88/100
tosunlab/hisarapp-core#510 ·
-
priority: p2 type: bug
难度 2/5 1-3 小时 新手友好度 78/100
googleapis/kotlin-genai#213 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
RevenueCat/purchases-hybrid-common#2039 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
partiql/partiql-scribe#223 ·
维护者通常 3 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
damontecres/Wholphin#2143 ·
维护者通常 2 天内回复