Features

Min SDK : 10

Price : Free

Language : Java

Download

Link : Github

Owner : rtugeek

Source Code : Download


ColorSeekBar

ScreenShot:

Attrs

attr format default
colorSeeds references
colorBarPosition integer 0
alphaBarPosition integer 0
maxPosition integer 100
bgColor color TRANSPARENT
barHeight dimension 2dp
barMargin dimension 5dp
thumbHeight dimension 30dp
showAlphaBar boolean false
isVertical boolean false

Gradle:

Release API Android Arsenal Step 1. Add the JitPack repository in your root build.gradle at the end of repositories:
  allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Step 2. Add the dependency
  compile 'com.github.rtugeek:ColorSeekBar:1.4.3'

Usage

XML
  <com.rtugeek.android.colorseekbar.ColorSeekBar
android:id="@+id/colorSlider"
android:layout_width="match_parent"
app:colorSeeds="@array/material_colors"
android:layout_height="wrap_content" />
JAVA
  colorSeekBar.setMaxPosition(100);
colorSeekBar.setColorSeeds(R.array.material_colors); // material_colors is defalut included in res/color,just use it.
colorSeekBar.setColorBarPosition(10); //0 - maxValue
colorSeekBar.setAlphaBarPosition(10); //0 - 255
colorSeekBar.setShowAlphaBar(true);
colorSeekBar.setBarHeight(5); //5dpi
colorSeekBar.setThumbHeight(30); //30dpi
colorSeekBar.setBarMargin(10); //set the margin between colorBar and alphaBar 10dpi
Listener
  colorSeekBar.setOnColorChangeListener(new ColorSeekBar.OnColorChangeListener() {
@Override
public void onColorChangeListener(int colorBarPosition, int alphaBarPosition, int color) {
textView.setTextColor(color);
//colorSeekBar.getAlphaValue();
}
});

Vertical Bar [BETA]

  <com.rtugeek.android.colorseekbar.ColorSeekBar
android:id="@+id/colorSlider"
android:layout_width="match_parent"
app:colorSeeds="@array/material_colors"
app:isVertical="true"
android:layout_height="wrap_content" />

getColor() issue

Render flow: 1.Activity->onCreate(); 2.Activity->onResume(); 3.ColorSeekBar->onMeasure(); 4.ColorSeekBar->onSizeChanged(); 5.ColorSeekBar->init(); 6.ColorSeekBar->onMeasure(); 7.ColorSeekBar->onDraw(); getColor()/getColors()/getColorIndexPosition() do not work correct until onDraw() method invoked. So, If you want to get color or something else form ColorSeekBar on Activity.onCreate() function, just do:
    mColorSeekBar.setOnInitDoneListener(new ColorSeekBar.OnInitDoneListener() {
@Override
public void done() {
mColorSeekBar.getColorIndexPosition(mColor);
//mColorSeekBar.getColors();
//mColorSeekBar.getColor();
}
});
Spread the word  

License

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Leon Fu <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.