Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

RecyclerView is scrolling to top, while user is scrolling down (bad anchorPosition?)

未关闭
#229 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
kotlin
领域
mobile

调研方向

首先,在持续向下滚动的同时于 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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

android/codelab-android-paging 的其他 Issue

查看 android/codelab-android-paging 的全部 Issue

相似的 Issue

更多 Kotlin Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。