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
Javernaut
December 11, 2014
Programming
99
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RecyclerView
Javernaut
December 11, 2014
Transcript
26 slides
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
More Decks by Javernaut
See All by Javernaut
What the Flutter?
javernaut
0
31
Other Decks in Programming
See All in Programming
AIエージェントの「テストは通るのに本番で壊れる」を減らす
shibuiwilliam
3
130
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
150
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
240
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
180
コード生成時代のAPI定義を支えるRequest Spec移行
pvcresin
0
300
エージェントの管理もエージェントに – herdr-core と自作バックログで作る司令塔 –
nearme_tech
PRO
2
150
Compiling Your Language to WasmGC & Friends
tanishiking
0
160
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
690
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
840
Going Full Circle with Virtual Graphs and Relational Databases
michaelsimons
1
110
高速開発を止めずに 性能を上げる Flyleのシステム刷新と改善の歴史
azihsoyn
0
110
AI Augmentation Techniques with Liberty
ivargrimstad
1
570
Featured
See All Featured
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.8k
4 Signs Your Business is Dying
shpigford
187
23k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
570
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
GraphQLとの向き合い方2022年版
quramy
50
15k
Product Roadmaps are Hard
iamctodd
55
13k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
650
Raft: Consensus for Rubyists
vanstee
143
7.9k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
690
Rebuilding a faster, lazier Slack
samanthasiow
85
9.8k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k