Android RecyclerView添加Header头部
Android RecyclerView不像以前的ListView那样直接添加头部,如果要给RecyclerView增加头部,则需要自己写或者使用第三方开源项目。
RecyclerViewHeader是github上的一个开源项目,旨在为Android RecyclerView增加头部,其在github上的项目主页是:https://github.com/blipinsk/RecyclerViewHeader
RecyclerViewHeader使用相对比较简单,写一个例子。
注意RecyclerViewHeader的布局文件写法:
android:layout_width="match_parent"
android:layout_height="match_parent">
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"><