Skip to content

A sample RecyclerAdapter for displaying multiple different view types in a feed.

License

Notifications You must be signed in to change notification settings

SeloSlav/heterogeneous-recycler-adapter

Repository files navigation

heterogeneous-recycler-adapter

A sample RecyclerAdapter for displaying multiple different view types in a feed.

On ocassion, you may require that your application provide multiple different layout types for the data that it handles. Just think about all the different ways you can interact with Facebook's News Feed. For example, your friends can post short status updates about what they are currently reading, or they might upload a large photo album from a vacation abroad. Sometimes, you'll even be notified of their latest jam on Soundcloud, or a sponsored story from an advertisor might be stuffed down your throat. Each of these posts will naturally be displayed differently in the feed. This sample project includes a RecyclerAdapter class that does just that; on one hand it displays images, on the other, text. This is determined by the data type returned by the object, but can easily be extended to change the view type depending on the position of the item in the list, i.e. even or odd placement, etc. Consider extending this project to include more than just the two view default types provided!

About

A sample RecyclerAdapter for displaying multiple different view types in a feed.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages