Skip to content
Let RecyclerView support add HeaderView and FooterView.
Java Other
  1. Java 99.8%
  2. Other 0.2%
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
gradle/wrapper
hf-recyclerview
.gitignore
.travis.yml
LICENSE
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
jcenter-publish
jcenter-publish.bat
settings.gradle

README.md

Android - HeaderAndFooterRecyclerView

Build Status Bintray Platform API License

Let RecyclerView support add HeaderView and FooterView.

一个支持添加 HeaderView 和 FooterView 的 RecyclerView。特征如下:

  • 无侵入式,使用方式和原有 RecyclerView 相同,不需要修改业务 Adapter。

  • 支持 LinearLayoutManager、GridLayoutManager 和 StaggeredGridLayoutManager 三种布局管理器的横向和纵向布局。

  • 支持多 HeaderView 和 FooterView。

  • 支持动态添加删除 HeaderView 和 FooterView。

  • 支持动态切换 Adapter 和 LayoutManager。

请在这里下载示例程序。

Usage

Gradle

implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.takwolf.android:hf-recyclerview:0.4.0'

Layout

<com.takwolf.android.hfrecyclerview.HeaderAndFooterRecyclerView
    android:id="@+id/recycler_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

Java

HeaderAndFooterRecyclerView recyclerView = (HeaderAndFooterRecyclerView) findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(context));
recyclerView.setAdapter(adapter);

View headerView = LayoutInflater.from(context).inflate(R.layout.header, recyclerView.getHeaderContainer(), false);
recyclerView.addHeaderView(headerView);

View footerView = LayoutInflater.from(context).inflate(R.layout.footer, recyclerView.getFooterContainer(), false);
recyclerView.addFooterView(footerView);

Author

TakWolf

takwolf@foxmail.com

http://takwolf.com

License

Copyright 2017 TakWolf

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.