belongs to Maven artifact androidx.car:car:1.0.0-alpha1

PagedScrollBarView

public class PagedScrollBarView
extends FrameLayout

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ androidx.car.widget.PagedScrollBarView


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

Summary

Nested classes

interface PagedScrollBarView.PaginationListener

Listener for when the list should paginate. 

Inherited constants

Inherited fields

Public constructors

PagedScrollBarView(Context context, AttributeSet attrs)
PagedScrollBarView(Context context, AttributeSet attrs, int defStyleAttrs)
PagedScrollBarView(Context context, AttributeSet attrs, int defStyleAttrs, int defStyleRes)

Public methods

boolean isDownEnabled()

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

boolean isDownPressed()

Returns true if the "down" button is pressed

boolean isUpPressed()

Returns true if the "up" button is pressed

void resetThumbColor()

Resets the color of thumb to default.

void setDayNightStyle(int dayNightStyle)

Sets how this PagedScrollBarView responds to day/night configuration changes.

void setDownButtonIcon(Drawable icon)

Sets the icon to be used for the down button.

void setDownEnabled(boolean enabled)

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

void setPaginationListener(PagedScrollBarView.PaginationListener listener)

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

void setParameters(int range, int offset, int extent, boolean animate)

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

void setThumbColor(int color)

Sets the color of thumb.

void setUpButtonIcon(Drawable icon)

Sets the icon to be used for the up button.

void setUpEnabled(boolean enabled)

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

Inherited methods

Public constructors

PagedScrollBarView

PagedScrollBarView (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

PagedScrollBarView

PagedScrollBarView (Context context, 
                AttributeSet attrs, 
                int defStyleAttrs)

Parameters
context Context

attrs AttributeSet

defStyleAttrs int

PagedScrollBarView

PagedScrollBarView (Context context, 
                AttributeSet attrs, 
                int defStyleAttrs, 
                int defStyleRes)

Parameters
context Context

attrs AttributeSet

defStyleAttrs int

defStyleRes int

Public methods

isDownEnabled

boolean isDownEnabled ()

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

Returns
boolean true if the down button is enabled. false otherwise.

isDownPressed

boolean isDownPressed ()

Returns true if the "down" button is pressed

Returns
boolean

isUpPressed

boolean isUpPressed ()

Returns true if the "up" button is pressed

Returns
boolean

resetThumbColor

void resetThumbColor ()

Resets the color of thumb to default.

setDayNightStyle

void setDayNightStyle (int dayNightStyle)

Sets how this PagedScrollBarView responds to day/night configuration changes. By default, the PagedScrollBarView is darker in the day and lighter at night.

Parameters
dayNightStyle int: A value from DayNightStyle.

See also:

setDownButtonIcon

void setDownButtonIcon (Drawable icon)

Sets the icon to be used for the down button.

Parameters
icon Drawable

setDownEnabled

void setDownEnabled (boolean enabled)

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

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

setPaginationListener

void setPaginationListener (PagedScrollBarView.PaginationListener listener)

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

Parameters
listener PagedScrollBarView.PaginationListener: The listener to set.

setParameters

void setParameters (int range, 
                int offset, 
                int extent, 
                boolean animate)

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.

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 boolean: Whether or not the thumb should animate from its current position to the position specified by the given range, offset and extent.

setThumbColor

void setThumbColor (int color)

Sets the color of thumb.

Custom thumb color ignores DayNightStyle. Calling resetThumbColor() resets to default color.

Parameters
color int: Resource identifier of the color.

setUpButtonIcon

void setUpButtonIcon (Drawable icon)

Sets the icon to be used for the up button.

Parameters
icon Drawable

setUpEnabled

void setUpEnabled (boolean enabled)

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

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