A simple material-based support library to bring consistent SeekBars
SeekBarCompat
A support library for the material design SeekBar in Android for API 14 and above.
Example
The SeekBarCompat picks up the PrimaryColor by default, but you can set custom colors for SeekBar thumb and progress too, both in xml and programmatically.
Xml
<app.minimize.com.seek_bar_compat.SeekBarCompat
android:id="@+id/materialSeekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxHeight="300sp"
app:progressColor="#AFF123"
app:progressBackgroundColor="#000"
app:thumbColor="#FF4444"
app:thumbAlpha="1.0"/>
Note: Add maxHeight attribute in xml - it fixes the thumb gravity issues on APIs < 21
In Xml you can also specify progressBackgroundColor - by default the progressBackgroundColor (progress-line color) is Black.
Programmatically
SeekBarCompat seekBarCompat = (SeekBarCompat) findViewById(R.id.materialSeekBar);
seekBarCompat.setThumbColor(Color.RED);
seekBarCompat.setProgressColor(Color.CYAN);
seekBarCompat.setProgressBackgroundColor(Color.BLUE);
seekBarCompat.setThumbAlpha(128); //you can also set alpha value for the thumb
Download
Repository available on jCenter
compile 'com.minimize.library:seekbar-compat:0.2.5'
If the dependency fails to resolve, add this to your project repositories
repositories {
maven {
url "http://dl.bintray.com/ahmedrizwan/maven"
}
}