# HeaderAndFooterRecyclerView **Repository Path**: HarmonyOS-tpc/HeaderAndFooterRecyclerView ## Basic Information - **Project Name**: HeaderAndFooterRecyclerView - **Description**: HeaderAndFooterRecyclerView is a ListContainer solution that supports addHeaderView, addFooterView to a ListContainer - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2021-04-15 - **Last Updated**: 2023-04-17 ## Categories & Tags **Categories**: harmonyos-layout **Tags**: None ## README # HeaderAndFooterRecyclerView HeaderAndFooterRecyclerView : HeaderAndFooterRecyclerView is a ListContainer solution that supports addHeaderView, addFooterView to a ListContainer # HeaderAndFooterRecyclerView includes : * Add header to ListContainer. * Add Footer to ListContainer. * Creating EndlessListContainer. * Add Footer to EndlessListContainer. * Add Footer to EndlessListContainer. # Usage Instructions The following core classes are the essential interface to HeaderAndFooterRecyclerView: HeaderAndFooterRecyclerView - Helps in adding Header and Footer to ListContainers 1. Setting ItemProvider for ListContainer: Create HeaderAndFooterRecyclerViewAdapter with BaseItem provider of ListContainer and call setItemProvider of the ListContainer ``` mHeaderAndFooterRecyclerViewAdapter = new HeaderAndFooterRecyclerViewAdapter(contactItemProvider); listContainer.setItemProvider(mHeaderAndFooterRecyclerViewAdapter); ``` 2. The steps to add Header: Note: Use any layout that you want to set as Header ``` RecyclerViewUtils.setHeaderView(listContainer, mLayoutScatter.parse(ResourceTable.Layout_header_layout, null, false)); ``` 3. The steps to add Footer: Note: Use any layout that you want to set as Footer ``` RecyclerViewUtils.setFooterView(listContainer, mLayoutScatter.parse(ResourceTable.Layout_footer_layout, null, false)); ``` 4. Creating EndlessRecyclerOnScrollListener: For the List container set the setScrolledListener, where with EndlessRecyclerOnScrollListener object ``` listContainer.setScrolledListener(mOnScrollListener); // mOnScrollListener defines the behavior on scrolling ``` NOTE: All the functionalities are demonstrated with List Container in Directional Layout # Installation Instructions 1. For using HeaderAndFooterRecyclerView module in your sample application, add below dependencies in "entry" module to generate hap/har: Modify entry build.gradle as below : ``` dependencies { implementation fileTree(dir: 'libs', include: ['*.har']) implementation project(path: ':library') } ``` 2. For using HeaderAndFooterRecyclerView in separate application, add the below dependencies and include "HeaderAndFooterRecyclerView.har" in libs folder of "entry" module : Modify entry build.gradle as below : ``` dependencies { implementation fileTree(dir: 'libs', include: ['*.har']) } ``` 3. For using HeaderAndFooterRecyclerView from a remote repository in separate application, add the below dependencies : Modify entry build.gradle as below : ``` dependencies { implementation 'io.openharmony.tpc.thirdlib:HeaderAndFooterRecyclerView:1.0.1' } ``` # License ``` Copyright 2015 Cundong 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. ```