# ScrollingView

# ScrollingView

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/view/ScrollingView.java+class:androidx.core.view.ScrollingView)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/view/ScrollingView "View this page in Java")

<br />

```
interface ScrollingView
```

<br />

Known direct subclasses  
[NestedScrollView](https://developer.android.com/reference/kotlin/androidx/core/widget/NestedScrollView),[RecyclerView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView)  

|----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [NestedScrollView](https://developer.android.com/reference/kotlin/androidx/core/widget/NestedScrollView) | NestedScrollView is just like[ScrollView](https://developer.android.com/reference/android/widget/ScrollView.html), but it supports acting as both a nested scrolling parent and child on both new and old versions of Android. |
| [RecyclerView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView) | A flexible view for providing a limited window into a large data set.                                                                                                                                                          |

Known indirect subclasses  
[BaseGridView](https://developer.android.com/reference/kotlin/androidx/leanback/widget/BaseGridView),[HorizontalGridView](https://developer.android.com/reference/kotlin/androidx/leanback/widget/HorizontalGridView),[VerticalGridView](https://developer.android.com/reference/kotlin/androidx/leanback/widget/VerticalGridView),[WearableRecyclerView](https://developer.android.com/reference/kotlin/androidx/wear/widget/WearableRecyclerView)  

|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [BaseGridView](https://developer.android.com/reference/kotlin/androidx/leanback/widget/BaseGridView)             | An abstract base class for vertically and horizontally scrolling lists.                                                                                                                                                                                                                                                                                                         |
| [HorizontalGridView](https://developer.android.com/reference/kotlin/androidx/leanback/widget/HorizontalGridView) | A[android.view.ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)that shows items in a horizontal scrolling list.                                                                                                                                                                                                                                  |
| [VerticalGridView](https://developer.android.com/reference/kotlin/androidx/leanback/widget/VerticalGridView)     | A[android.view.ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html)that shows items in a vertically scrolling list.                                                                                                                                                                                                                                  |
| [WearableRecyclerView](https://developer.android.com/reference/kotlin/androidx/wear/widget/WearableRecyclerView) | Wearable specific implementation of the[RecyclerView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView)enabling[setCircularScrollingGestureEnabled](https://developer.android.com/reference/kotlin/androidx/wear/widget/WearableRecyclerView#setCircularScrollingGestureEnabled(boolean))circular scrolling} and semi-circular layouts. |

*** ** * ** ***

An interface that can be implemented by Views to provide scroll related APIs.

## Summary

|                            ### Public functions                             |
|-----------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [computeHorizontalScrollExtent](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollExtent())`()` Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range. |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [computeHorizontalScrollOffset](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollOffset())`()` Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range. |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [computeHorizontalScrollRange](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollRange())`()` Compute the horizontal range that the horizontal scrollbar represents.                           |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [computeVerticalScrollExtent](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollExtent())`()` Compute the vertical extent of the vertical scrollbar's thumb within the vertical range.           |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [computeVerticalScrollOffset](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollOffset())`()` Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range.         |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [computeVerticalScrollRange](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollRange())`()` Compute the vertical range that the vertical scrollbar represents.                                   |

## Public functions

### computeHorizontalScrollExtent

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun computeHorizontalScrollExtent(): Int
```

Compute the horizontal extent of the horizontal scrollbar's thumb within the horizontal range. This value is used to compute the length of the thumb within the scrollbar's track.

The range is expressed in arbitrary units that must be the same as the units used by[computeHorizontalScrollRange](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollRange())and[computeHorizontalScrollOffset](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollOffset()).

The default extent is the drawing width of this view.  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the horizontal extent of the scrollbar's thumb |

|                                                                     See also                                                                     |
|--------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [computeHorizontalScrollRange](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollRange())   |   |
| [computeHorizontalScrollOffset](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollOffset()) |   |

### computeHorizontalScrollOffset

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun computeHorizontalScrollOffset(): Int
```

Compute the horizontal offset of the horizontal scrollbar's thumb within the horizontal range. This value is used to compute the position of the thumb within the scrollbar's track.

The range is expressed in arbitrary units that must be the same as the units used by[computeHorizontalScrollRange](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollRange())and[computeHorizontalScrollExtent](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollExtent()).

The default offset is the scroll offset of this view.  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the horizontal offset of the scrollbar's thumb |

|                                                                     See also                                                                     |
|--------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [computeHorizontalScrollRange](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollRange())   |   |
| [computeHorizontalScrollExtent](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollExtent()) |   |

### computeHorizontalScrollRange

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun computeHorizontalScrollRange(): Int
```

Compute the horizontal range that the horizontal scrollbar represents.

The range is expressed in arbitrary units that must be the same as the units used by[computeHorizontalScrollExtent](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollExtent())and[computeHorizontalScrollOffset](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollOffset()).

The default range is the drawing width of this view.  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|--------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the total horizontal range represented by the horizontal scrollbar |

|                                                                     See also                                                                     |
|--------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [computeHorizontalScrollExtent](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollExtent()) |   |
| [computeHorizontalScrollOffset](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeHorizontalScrollOffset()) |   |

### computeVerticalScrollExtent

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun computeVerticalScrollExtent(): Int
```

Compute the vertical extent of the vertical scrollbar's thumb within the vertical range. This value is used to compute the length of the thumb within the scrollbar's track.

The range is expressed in arbitrary units that must be the same as the units used by[computeVerticalScrollRange](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollRange())and[computeVerticalScrollOffset](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollOffset()).

The default extent is the drawing height of this view.  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|----------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the vertical extent of the scrollbar's thumb |

|                                                                   See also                                                                   |
|----------------------------------------------------------------------------------------------------------------------------------------------|---|
| [computeVerticalScrollRange](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollRange())   |   |
| [computeVerticalScrollOffset](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollOffset()) |   |

### computeVerticalScrollOffset

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun computeVerticalScrollOffset(): Int
```

Compute the vertical offset of the vertical scrollbar's thumb within the horizontal range. This value is used to compute the position of the thumb within the scrollbar's track.

The range is expressed in arbitrary units that must be the same as the units used by[computeVerticalScrollRange](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollRange())and[computeVerticalScrollExtent](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollExtent()).

The default offset is the scroll offset of this view.  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|----------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the vertical offset of the scrollbar's thumb |

|                                                                   See also                                                                   |
|----------------------------------------------------------------------------------------------------------------------------------------------|---|
| [computeVerticalScrollRange](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollRange())   |   |
| [computeVerticalScrollExtent](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollExtent()) |   |

### computeVerticalScrollRange

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun computeVerticalScrollRange(): Int
```

Compute the vertical range that the vertical scrollbar represents.

The range is expressed in arbitrary units that must be the same as the units used by[computeVerticalScrollExtent](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollExtent())and[computeVerticalScrollOffset](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollOffset()).  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | the total vertical range represented by the vertical scrollbar The default range is the drawing height of this view. |

|                                                                   See also                                                                   |
|----------------------------------------------------------------------------------------------------------------------------------------------|---|
| [computeVerticalScrollExtent](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollExtent()) |   |
| [computeVerticalScrollOffset](https://developer.android.com/reference/kotlin/androidx/core/view/ScrollingView#computeVerticalScrollOffset()) |   |