TtScrollBar
A RecyclerView's scroll bar to control and visualize scrolling status.
Besides the basic scroll bar functionalities, this control also provides additional features:
A scroll bar indicator - an extra view attached to this control's parent view to present extra information based on the scrolling position.
Scroll by page - scrolls ttTargetView by page while the up or down button is pressed.
Scroll to top - scrolls ttTargetView to the top page while the up button is pressed.
All theme attributes used by this control are declared in com.tomtom.tools.android.core.theme
. To use this control, it is mandatory to define these attribute values.
Note: There are few limitations of the current implementation.
ttTargetView has to be a RecyclerView and the RecyclerView.LayoutManager can only be a vertical LinearLayoutManager.
It can only be put inside a ConstraintLayout.
Parameters
The display context.
The attribute set provided in the layout XML file.
The default style attribute set.
Types
Properties
The behavior of the scroll bar buttons. It controls how the ttTargetView be scrolled when pressing ttUpButtonDrawable/ ttDownButtonDrawable. The default value is ButtonAction.NONE.
The drawable for the scroll downward button. No down button if this is set to null
.
The custom drawable for the scroll bar handle. A default handle is applied when this is set to null
.
The scrolling behavior of the scroll bar. It controls how the ttTargetView is scrolled. The default value is ScrollBehavior.SCROLL_BY_PIXEL.
Showing the scrolling indicator when set to true
. The default value is `false. The indicator is an extra view attached to this control's parent view to present extra information based on the scrolling position. The indicator will be positioned to overlay the ttTargetView. If the scrollbar is to the left of the target view, the indicator will be placed on the right side of the scrollbar and vice versa.
The RecyclerView to which the scroll bar needs to be attached. It has to be set in order to make the scroll bar work.
The custom drawable for the scroll bar track. A default track is applied when this is set to null
.
Whether the scroll track below the handle is visible. Other visual aspects of the scroll bar (such as the handle color) may also adjust as a result of changing this. This is true
by default.
The drawable for the scroll upward button. No up button if this is set to null
.
Functions
Sets the down button drawable by providing the drawableResolver.
Sets the up button drawable by providing the drawableResolver.