一个强大的 RecyclerView ItemDecoration, 支持常见的布局管理器。
一个强大的 RecyclerView ItemDecoration, 支持常见的布局管理器。
「中文版文档点这里」
(Please pay attention to a better project StickyItemDecoration)
A powerful pinned section header library. The realization of ideas comes from「pinned-section-item-decoration」. Please mark a star if you think it's helpful.(^∀^)
BaseRecyclerViewAdapterHelper(It is highly recommended to use this adapter, which can greatly reduce the amount of work. The current demo is using v2.9.42.)
To add a dependency using Gradle:
If using androidx
compile 'com.oushangfeng:PinnedSectionItemDecoration:1.3.2-androidx'
otherwise
compile 'com.oushangfeng:PinnedSectionItemDecoration:1.3.2'Adapter needs to process the span count of header through the FullSpanUtil.
@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
FullSpanUtil.onAttachedToRecyclerView(recyclerView, this, StockEntity.StockInfo.TYPE_HEADER);
}
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
super.onViewAttachedToWindow(holder);
FullSpanUtil.onViewAttachedToWindow(holder, this, StockEntity.StockInfo.TYPE_HEADER);
}To achieve large pinned section header, RecyclerView only need to add a PinnedHeaderItemDecoration. Note that the top layer of the header where the layout can not be set marginTop.「See StockActivity」
…To achieve small pinned section header is a little bit more complex, such as the layout A of the data .
…This is a layout B with a small pinned section header.
…The layout B add a header compare whit layout A,then RecyclerView only need to add a SmallPinnedHeaderItemDecoration. Note that the top layer of the header where the layout can not be set marginTop.「See SecondActivity」
…Copyright 2016 oubowu
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.暂无开放 Issues,或尚未同步最近议题。