RecyclerView to the Rescue

06/05/2015 - 14:30 to 15:10
Stage 3

Session abstract: 

Any Android developer who has worked with ListView or GridView has felt the pain of their respective limitations when trying to do anything other than the most basic of lists. Animations are poorly supported, and complex layouts like grids that contain items that span columns are exceedingly difficult to pull off. Usually requiring varying levels of hackery, or painstaking custom implementations of AbsListView.

I want to liberate developers with RecyclerView by educating them on how to use it as well as excite them with its potential for making modern, attractive, and silky-smooth user interfaces.

My 40 minute session will focus on the following areas:

RecyclerView “Sizzle Reel”

To get developers excited about RecyclerView I will show examples of it in action, solving many common problems faced today. These include:

  • Lists/Grids with items that animate in as you scroll.

  • Grids that have items that span some or all columns. This includes grids with headers and footers, and arbitrary items in the middle of the list (think section headers).

  • Seamlessly switching between grid and list, vertical and horizontal scrolling.

This will be a live demo using a sample app I've built for this session.

RecyclerView Fundamentals

Starts with an explanation of how RecyclerView is architected and how it uses separation of concerns to become much more powerful than its AbsListView forebearers.

Followed by an introduction to the new terms, patterns, and components needed to get RecyclerView up and running. These include:

  • RecyclerView.ViewHolder: What it is and an explanation of the ViewHolder pattern. Includes code snippets of a simple ViewHolder.

  • RecyclerView.Adapter: The differences between this adapter and the historic BaseAdapter. Includes code snippets that tie in with the previous ViewHolder example.

  • RecyclerView.LayoutManager: What it does and how it works with RecyclerView. Includes explanations of 2 of the framework-provided LayoutManagers (LinearLayoutManager and GridLayoutManager).

This segment will finish with a concise example of putting all the pieces together. By the end of this segment, you will have a firm understanding of the basics of RecyclerView and how you can start using it in your own apps.

The third and final segment will focus on some advanced RecyclerView techniques used to achieve complex layouts and animations.

Advanced RecyclerView

This segment will focus on the examples shown in introduction "sizzle" reel, and how to implement them.

The first advanced technique will demonstrate how to animate items in as the user scrolls down the list. There will be a demo of what the technique achieves along with an explanation and code snippet.

The second advanced technique will focus on how to switch between list and grid views with the same RecyclerView instance. As well as switching between horizontal and vertical scrolling. There will be a demo of what the technique achieves along with an explanation and code snippet.

The third and final technique show you how to implement a grid view with items that span some or all of the columns. There will be a demo of what the technique achieves along with an explanation and code snippet.

All of the above demos will be done live on a device running a sample app that I’ve created just for this session.


The session will close with a quick summary of what was presented along with links to the GitHub repository containing the code for the sample app used for the demos.