Reputation: 6863
I wish to create a LazyRow
where one of the items will be higher in elevation than the others, as in essentially focused. Now, as I scroll, I wish to highlight the next item with elevation. What I want is something like, the first visible item in the Row, currently, shall be elevated above others. Any ideas?
Upvotes: 1
Views: 1753
Reputation: 4157
To get first visible index from list, You can use the LazyListState.firstVisibleItemIndex
property.
Official guide regarding the Lists: Reacting to scroll position
For simple use-cases, apps commonly only need to know information about the first visible item. For this LazyListState provides the
firstVisibleItemIndex
andfirstVisibleItemScrollOffset
properties.
Upvotes: 2