Easily add Sticky Headers to your RecyclerView

StickyHeaders

项目地址:bgogetap/StickyHeaders 

简介:Easily add Sticky Headers to your RecyclerView

更多:作者   提 Bug   

标签:

 

Download Build Status

Easily add Sticky Headers to your RecyclerView

Setup

Implement StickyHeaderHandler in your Presenter/Adapter/Activity or whatever class has access to your RecyclerView adapter dataset

Make sure the parent of the RecyclerView is a FrameLayout or CoordinatorLayout (this will be verified at Runtime)

Instantiate a StickyLayoutManager and set that as the LayoutManager for your RecyclerView.

For items in your dataset that you want to act as sticky headers, implement the marker interface StickyHeader.

That's it! See the example app for more in depth details.

Additional Features

Add elevation to your headers (animated in and out) on Lollipop and above:

layoutManager.elevateHeaders(true) OR layoutManager.setElevation(int dp)

Add a listener to be notified when headers are attached/re-bound or detached:

StickyLayoutManager#setStickyHeaderListener

You will be passed the instance of the view that was either attached/re-bound or detached, as well as the adapter position of the data that view represents. It is important to note that the adapter position passed to headerDetached may not be the current position in the data set that the view was originally bound with. This can happen if the data has changed since that header was made sticky.

The adapter position passed in headerAttached will always be correct at that moment.

StickyHeaders

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值