OnScrollListener
interface OnScrollListener
android.widget.AbsListView.OnScrollListener |
Interface definition for a callback to be invoked when the list or grid has been scrolled.
Summary
Constants | |
---|---|
static Int |
The user had previously been scrolling using touch and had performed a fling. |
static Int |
The view is not scrolling. |
static Int |
The user is scrolling using touch, and their finger is still on the screen |
Public methods | |
---|---|
abstract Unit |
onScroll(view: AbsListView!, firstVisibleItem: Int, visibleItemCount: Int, totalItemCount: Int) Callback method to be invoked when the list or grid has been scrolled. |
abstract Unit |
onScrollStateChanged(view: AbsListView!, scrollState: Int) Callback method to be invoked while the list view or grid view is being scrolled. |
Constants
SCROLL_STATE_FLING
static val SCROLL_STATE_FLING: Int
The user had previously been scrolling using touch and had performed a fling. The animation is now coasting to a stop
Value: 2
SCROLL_STATE_IDLE
static val SCROLL_STATE_IDLE: Int
The view is not scrolling. Note navigating the list using the trackball counts as being in the idle state since these transitions are not animated.
Value: 0
SCROLL_STATE_TOUCH_SCROLL
static val SCROLL_STATE_TOUCH_SCROLL: Int
The user is scrolling using touch, and their finger is still on the screen
Value: 1
Public methods
onScroll
abstract fun onScroll(
view: AbsListView!,
firstVisibleItem: Int,
visibleItemCount: Int,
totalItemCount: Int
): Unit
Callback method to be invoked when the list or grid has been scrolled. This will be called after the scroll has completed
Parameters | |
---|---|
view |
AbsListView!: The view whose scroll state is being reported |
firstVisibleItem |
Int: the index of the first visible cell (ignore if visibleItemCount == 0) |
visibleItemCount |
Int: the number of visible cells |
totalItemCount |
Int: the number of items in the list adapter |
onScrollStateChanged
abstract fun onScrollStateChanged(
view: AbsListView!,
scrollState: Int
): Unit
Callback method to be invoked while the list view or grid view is being scrolled. If the view is being scrolled, this method will be called before the next frame of the scroll is rendered. In particular, it will be called before any calls to Adapter.getView(int, View, ViewGroup)
.
Parameters | |
---|---|
view |
AbsListView!: The view whose scroll state is being reported |
scrollState |
Int: The current scroll state. One of SCROLL_STATE_TOUCH_SCROLL or SCROLL_STATE_IDLE . |