addHeaderView in RecyclerView

As we all know there is addHeaderView in ListView to add header item. But there is no equivalent to this in RecyclerView. Here i am sharing short demo for addHeaderView in RecyclerView.

add dependency in build.gradle

add RecyclerView in your main xml



Here is the code for your adapter class for adding divider in RecyclerView

line_divider.xml for custom divider of RecyclerView

Finally initialize RecyclerView in your MainActivity and set adapter for it.

addHeaderView in RecyclerView



Requesting Runtime Permission – Part 2
Runtime Permission in Pre-Marshmallow