MaterialScrollBar

Additional

Language
Java
Version
13.3.2 (Nov 30, 2018)
Created
Aug 20, 2015
Updated
Feb 6, 2019
Owner
Turing Technologies (Wynne Plaga) (turing-tech)
Contributors
androideveloper
Huqiu Liao (liaohuqiu)
Luke Klinker (klinker24)
marbat87
Rainer-Lang
MFlisar
Turing Technologies (Wynne Plaga) (turing-tech)
hakimrie
MonikaOlkowska
9
Activity
Badge
Generate
Download
Source code
APK file

Show card

MaterialScrollBar

An Android library that brings the Material Design 5.1 scrollbar to pre-5.1 devices. Designed for Android's recyclerView.

Video

Image Preview

Google Play - Test Out the App

Donate

Table of Contents

  1. Gradle
  2. Documentation
    1. How to use
    2. My recyclerView elements aren't all the same size! What do I do?
    3. Indicators
    4. Specific Indicators
  3. License

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.


The indicator should be either AlphatbetIndicator, DateAndTimeIndicator, or CustomIndicator. See below for specific instructions per indicator.

{{addSpace}} is a boolean which indicates whether there should be space in between the indicator and the bar. True adds space, as in the latest version of the Google Launcher, while false adds no space, as in the Android 5.1 system scrollbars.

To use an indicator, you MUST make your recyclerView's adapter implement the relevant interface. If you do not, the library will throw a runtime error informing you of your mistake. See documentation for the relevant interface.