Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

PagedScrollBarView

open class PagedScrollBarView : ViewGroup
kotlin.Any
   ↳ android.view.View
   ↳ android.view.ViewGroup
   ↳ androidx.car.widget.PagedScrollBarView

A custom view to provide list scroll behaviour -- up/down buttons and scroll indicator.

Summary

Nested classes
abstract

Listener for when the list should paginate.

Public constructors
<init>(context: Context!)

<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttrs: Int)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttrs: Int, defStyleRes: Int)

Public methods
open Unit

Sets the listener that will be notified when the up and down buttons have been pressed.

open Boolean

Returns true if the "up" button is pressed

open Unit

Sets whether or not the down button on the scroll bar is clickable.

open Unit

Sets whether or not the scroll bar thumb is visible, the default value is true.

open Unit
setButtonRippleBackground(@DrawableRes backgroundResId: Int)

Sets the drawable that will function as the background for the buttons in this view.

open Unit
setScrollbarThumbColor(@ColorRes color: Int)

Sets the color of thumb.

open Boolean

Returns true if the scroll bar thumb is visible

open Unit

Sets the icon to be used for the down button.

open Boolean

Returns whether or not the down button on the scroll bar is clickable.

open Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)

open Unit
setParameters(range: Int, offset: Int, extent: Int, animate: Boolean)

Sets the range, offset and extent of the scroll bar.

open Unit

Sets the icon to be used for the up button.

open Unit

Sets whether or not the up button on the scroll bar is clickable.

open Boolean

Returns true if the "down" button is pressed

open Unit
setButtonTintColor(@ColorRes tintResId: Int)

Sets the tint color for the up and down buttons of this view.

Protected methods
open Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)

Public constructors

<init>

PagedScrollBarView(context: Context!)

<init>

PagedScrollBarView(context: Context!, attrs: AttributeSet!)

<init>

PagedScrollBarView(context: Context!, attrs: AttributeSet!, defStyleAttrs: Int)

<init>

PagedScrollBarView(context: Context!, attrs: AttributeSet!, defStyleAttrs: Int, defStyleRes: Int)

Public methods

setPaginationListener

open fun setPaginationListener(listener: PagedScrollBarView.PaginationListener!): Unit

Sets the listener that will be notified when the up and down buttons have been pressed.

Parameters
listener PagedScrollBarView.PaginationListener!: The listener to set.

isUpPressed

open fun isUpPressed(): Boolean

Returns true if the "up" button is pressed

setDownEnabled

open fun setDownEnabled(enabled: Boolean): Unit

Sets whether or not the down button on the scroll bar is clickable.

Parameters
enabled Boolean: true if the down button is enabled.

setScrollbarThumbEnabled

open fun setScrollbarThumbEnabled(show: Boolean): Unit

Sets whether or not the scroll bar thumb is visible, the default value is true.

Parameters
show Boolean: true if the scroll bar thumb is visible.

setButtonRippleBackground

open fun setButtonRippleBackground(@DrawableRes backgroundResId: Int): Unit

Sets the drawable that will function as the background for the buttons in this view. This background should provide the ripple.

Parameters
backgroundResId Int: The drawable resource identifier for the ripple background.

setScrollbarThumbColor

open fun setScrollbarThumbColor(@ColorRes color: Int): Unit

Sets the color of thumb.

Parameters
color Int: Resource identifier of the color.

isScrollbarThumbEnabled

open fun isScrollbarThumbEnabled(): Boolean

Returns true if the scroll bar thumb is visible

setDownButtonIcon

open fun setDownButtonIcon(icon: Drawable!): Unit

Sets the icon to be used for the down button.

isDownEnabled

open fun isDownEnabled(): Boolean

Returns whether or not the down button on the scroll bar is clickable.

Return
Boolean: true if the down button is enabled. false otherwise.

onLayout

open fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit

setParameters

open fun setParameters(range: Int, offset: Int, extent: Int, animate: Boolean): Unit

Sets the range, offset and extent of the scroll bar. The range represents the size of a container for the scrollbar thumb; offset is the distance from the start of the container to where the thumb should be; and finally, extent is the size of the thumb.

These values can be expressed in arbitrary units, so long as they share the same units. The values should also be positive.

Parameters
range Int: The range of the scrollbar's thumb
offset Int: The offset of the scrollbar's thumb
extent Int: The extent of the scrollbar's thumb
animate Int: Whether or not the thumb should animate from its current position to the position specified by the given range, offset and extent.

setUpButtonIcon

open fun setUpButtonIcon(icon: Drawable!): Unit

Sets the icon to be used for the up button.

setUpEnabled

open fun setUpEnabled(enabled: Boolean): Unit

Sets whether or not the up button on the scroll bar is clickable.

Parameters
enabled Boolean: true if the up button is enabled.

isDownPressed

open fun isDownPressed(): Boolean

Returns true if the "down" button is pressed

setButtonTintColor

open fun setButtonTintColor(@ColorRes tintResId: Int): Unit

Sets the tint color for the up and down buttons of this view.

Parameters
tintResId Int: Resource identifier of the tint color.

Protected methods

onMeasure

protected open fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int): Unit