Add RecyclerView body
Can I use RecyclerView as a parent element for other views declared in XML?
<android.support.v7.widget.RecyclerView ... > <TextView ... /> <ImageView ... /> </android.support.v7.widget.RecyclerView>
Something like this. I need this in order to get my collapsing toolbar working with main content on my activity.
You have to use a RecyclerView.Adapter with RecyclerView. But items in RecyclerView.Adapter can have different viewType just like ListView. With this feature you can achieve something like HeaderView in RecyclerView and FooterView in RecyclerView, and make these views scroll with your items.
No, You can't add any child view inside Recycler View. See the example https://github.com/javatechig/Android-RecyclerView-Example.
Create separate .xml file (e.g. single_recycler_view_row.xml) and use it to build layout for single RecyclerView item. Then you need to create an adapter and pass single_recycler_view_row.xml as a parameter.
To make sure that your RecyclerView works well with CollapsingToolbarLayout add
attribute to RecyclerView.