MaterialScrollBar
An Android library that brings the Material Design 5.1 scrollbar to pre-5.1 devices. Designed for Android's recyclerView
.
Google Play - Test Out the App
Table of Contents
Gradle
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.turing-tech:MaterialScrollBar:13.+'
}
Documentation
Note: All customisation methods (setAutoHide
, setBarColor
, etc) return the materialScrollBar
, so they can be chained together if wanted. Alternatively, you can just operate on a variable.
How to use
The library comes in two flavours, drag and touch. Try both out to see which you prefer.
Option 1 - Drag
<com.turingtechnologies.materialscrollbar.DragScrollBar
android:id="@+id/dragScrollBar"
android:layout_width="wrap_content"
app:msb_recyclerView="@id/recyclerView"
app:msb_lightOnTouch="[[boolean]]"
android:layout_height="match_parent" />
or
Option 2 - Touch
<com.turingtechnologies.materialscrollbar.TouchScrollBar
android:id="@+id/touchScrollBar"
android:layout_width="wrap_content"
app:msb_recyclerView="@id/recyclerView"
app:msb_lightOnTouch="[[boolean]]"
android:layout_height="match_parent" />
Additonal optional attributes:
- msb_handleColor - Color
- msb_barColor - Color
- msb_handleOffColor - Color
- msb_textColor - Color
- msb_barThickness - Integer
- msb_rightToLeft - Boolean
Please note that for both of these configurations, both recyclerView and lightOnTouch* must have a valid value. The recyclerView attribute should point to the id of the recyclerView
to which you want to link the scrollbar.
* lightOnTouch behaves like this: A value of true will cause the handle to be grey until pressed, when it will become the normal accent color (as set). A value of false will cause the handle to always have the accent color, even when not being pressed.