LayoutManagerGradually
自定义 LinearLayoutManager 的渐进式实现,最终实现一个简单的 LinearLayoutManager(只支持 LinearLayoutManager.VERTICAL 滚动方向)。该工程适合对 LayoutManager 整体流程的学习与理解,整个 LinearLayoutManager 代码分为多份子文件,每个文件都是对前一段代码的补充,方便理解。
Install / Use
/learn @VomPom/LayoutManagerGraduallyREADME
LayoutManagerGradually
自定义 LinearLayoutManager 的渐进式实现,最终实现一个简单的 LinearLayoutManager(只支持 LinearLayoutManager.VERTICAL 滚动方向)。该工程适合对 LayoutManager 整体流程的学习与理解,整个 LinearLayoutManager 代码分为多份子文件,每个文件都是对前一段代码的补充,方便理解。
最终效果
实现以下逻辑
- 数据填充只需要填充屏幕范围内的 ItemView
- 回收掉屏幕以外的ItemView
- 屏幕外 ItemView 再回到屏幕后数据需要重新填充
- 对滑动边界边界进行处理
- 对 scrollToPosition 进行支持
- 对 smoothScrollToPosition 进行支持
逐步实现
0 最简单的 LayoutManager
<img src=".img/0.gif" width=20% />1 更合理的数据添加方式
<img src=".img/1.gif" width=20% />2 对屏幕外的View回收
<img src=".img/2.gif" width=20% />3 向上滑动的时View的填充
<img src=".img/3.gif" width=20% />4 两个方向的View填充
<img src=".img/4.gif" width=20% />5 对顶部和底部滑动边界处理
<img src=".img/5.gif" width=20% />6 实现 scrollToPosition
<img src=".img/6.gif" width=20% />7 实现 smoothScrollToPosition
<img src=".img/7.gif" width=20% />Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
