Skip to content

k-turek/StickyItemDecoration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

StickyItemDecoration

device-2022-05-31-141030.mp4

Usage

It's not necessary to create a sticky item as RecyclerView is initializing. You can add it after you create an adapter and submit some items, because it's just an item decoration.

First, create a view and bind some data with it. Create an item decoration and add it to the recyclerView wherever you want.

val view = layoutInflater.inflate(R.layout.view_holder, recyclerView, false)
val stickyView = ViewHolder(view).apply { bind(stickyItem) }.itemView
val stickyItemDecoration = StickyItemDecoration(stickyView, stickyItem.adapterPosition)
recyclerView.addItemDecoration(stickyItemDecoration)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages