views-widgets-samples
views-widgets-samples copied to clipboard
Example of adding subheaders
Subheaders (aka section headers) in lists and grids very common and indeed part of the material design spec (http://www.google.fr/design/spec/components/subheaders.html).
On the implementation side, there appear to be two primary strategies for rendering the headers in the recycler view. One is to use an ItemDecorator and the other is to use two different ViewHolder types. This library https://github.com/timehop/sticky-headers-recyclerview appears to be leading the way on the decorator pattern, while this tidy example https://gist.github.com/gabrielemariotti/4c189fb1124df4556058 (which is apparently a port of some older google code) uses the view holder types and a wrapper adapter.
It would be great to see an example of the pattern the Inbox app uses, where the headers are dynamically generated based on the content of the items. It seems to be such a common pattern it could nearly be accommodated in the support library. Failing that the source code of the Inbox app would suffice ;)
+1
@halfbaked did you find any sample code ?
It is a long time ago now... but maybe something like this will be useful to you https://github.com/willblaschko/header-footer-recycler-view
On 9 February 2016 at 19:32, kumawatmanish [email protected] wrote:
@halfbaked https://github.com/halfbaked did you find any sample code ?
— Reply to this email directly or view it on GitHub https://github.com/googlesamples/android-RecyclerView/issues/9#issuecomment-181994471 .
+1 Pretty old issue, but hoping it gets added.
+1 There are many good examples online. But, it would be great to get a good example from Google directly. :)