Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
RecyclerView
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Javernaut
December 11, 2014
Programming
94
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RecyclerView
Javernaut
December 11, 2014
More Decks by Javernaut
See All by Javernaut
What the Flutter?
javernaut
0
27
Other Decks in Programming
See All in Programming
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
4
3.5k
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
270
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
2
540
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
290
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
610
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
phperだってパンチカードでコーディングしたい
o0h
PRO
0
330
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
17k
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
How STYLIGHT went responsive
nonsquared
100
6.3k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
300
Docker and Python
trallard
47
4.2k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
300
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
Transcript
RecyclerView
Agenda • Example • Basics • Not so «Basics» •
More info and links
Example is there ->
Basics • Gradle dependency: com.android.support:recyclerview-v7:21.+ • RecyclerView LayoutManager Adapter
It’s over 8000 Lines in RecyclerView.java
RecyclerView • Extends ViewGroup (not AdapterView!) • Main job -
to recycle child views (Recycler)
RecyclerView • Delegates view constructing to Adapter • Delegates layout
logic to LayoutManager • Delegates item animations and decorations
Adapter • Constructs Views from model • With RecyclerView forces
ViewHolder pattern • Should attach click logic since there is no onItemClickListener
Adapter • onCreateViewHolder • onBindViewHolder • getItemCount Abstract methods
Adapter notifyDataSetChanged Data set changes method
Adapter • notifyItemChanged • notifyItemInserted • notifyItemRemoved • notifyItemMoved Data
set changes methods • notifyItemRangeChanged • notifyItemRangeInserted • notifyItemRangeRemoved
Adapter • Item types • Item ids • Observers for
data changes Other stuff
AdapterDataObserver • onChanged • onItemRangeChanged • onItemRangeInserted • onItemRangeMoved •
onItemRangeRemoved Class
LayoutManager • Item positioning • Scrolling handling • State persisting
LayoutManager Out of the box: Linear… StaggeredGrid… Grid… 2k 2k
+ 0.5k 2.5k
CustomLayoutManager • Headache • Consider subclassing existing one • Use
guides from Links section and existed LM sources
CustomLayoutManager • onLayoutChildren Item measuring and positioning • measureChild •
measureChildWithMargins • layoutDecorated
CustomLayoutManager • canScrollHorizontally • canScrollVertically • scrollHorizontallyBy • scrollVerticallyBy Scrolling
with finger • offsetChildrenHorizontal • offsetChildrenVertical
CustomLayoutManager • scrollToPosition • smoothScrollToPosition Scrolling by code
CustomLayoutManager Scrollbars • computeHorizontalScrollExtent • computeHorizontalScrollOffset • computeHorizontalScrollRange • computeVerticalScrollExtent
• computeVerticalScrollOffset • computeVerticalScrollRange
Visual effects • animateAdd • animateChange • animateMove • animateRemove
ItemAnimator ItemDecoration • getItemOffsets • onDraw • onDrawOver
Other stuff • SmoothScroller (LinearSmoothScroller) • RecycledViewPool • OrientationHelper •
OnItemTouchListener
Conclusion • Should we start using RV? - Yes •
Released • Out of box animations, ViewHolder, several LayoutManagers • Dividers absence solves with ItemDecoration
Conclusion • Should we use only RV? - No •
Doesn’t have ViewPager’s behavior • SwipeToDismiss, Adapter cycling and other 3rd party features should be implemented manually
Links • RecyclerView Samples • Dave Smith's blog • TwoWayView
Zbaziba for your attention