A custom SeekBar on Android, which can be changed the size
, color
, thumb drawable
, tick drawable
, texts
, indicator
, also can show an indicator view with progress above SeekBar when seeking. Welcome submit issue
or pull request
.
Download the demo.apk for more details about usage.
IndicatorSeekBar is ok to use in ConstraintLayout/AppbarLayout/NestedScrollview/RecyclerView/ViewPager/ListView/ScrollView/GridView/Dialog scrollable situation.
dependencies {
//recommend using latest version.
//e.g. compile 'com.github.warkiz.widget:indicatorseekbar:1.2.6'
compile 'com.github.warkiz.widget:indicatorseekbar:${LATEST_VERSION}'
}
<com.warkiz.widget.IndicatorSeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:isb_max="100"
app:isb_min="10"
app:isb_progress="34"
app:isb_show_indicator="true" />
<com.warkiz.widget.IndicatorSeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:isb_indicator_type="circular_bubble"
app:isb_progress="50"
app:isb_seek_bar_type="discrete_ticks_texts"
app:isb_tick_num="6"
app:isb_tick_type="oval" />
IndicatorSeekBar indicatorSeekBar = new IndicatorSeekBar.Builder(this)
.setMax(200)
.setMin(0)
.setProgress(35)
.setSeekBarType(IndicatorSeekBarType.DISCRETE_TICKS)
.setTickType(TickType.OVAL)
.setTickNum(8)
.setBackgroundTrackSize(2)//dp size
.setProgressTrackSize(3)//dp size
.setIndicatorType(IndicatorType.SQUARE_CORNERS)
.setIndicatorColor(Color.parseColor("#0000FF"))
.build();
//change build params at the runtime.
indicatorSeekBar.getBuilder()
.setMax(232)
.setMin(43)
.setTickType(TickType.OVAL)
.setTickColor(Color.parseColor("#0000FF"))
.apply();
- customized color/size (tick,thumb,track,text,indicator,indicator-text)
-
choose different series SeekBar type.(continuous,discrete series)
-
choose different indicator type.(rectangle,rectangle_rounded_corner,circular_bubble,custom)
-
customized thumb drawable
-
customized tick drawable
-
customized indicator
-
customized indicator's top content view
indicatorSeekBar.setOnSeekChangeListener(new IndicatorSeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(IndicatorSeekBar seekBar, int progress, float progressFloat, boolean fromUserTouch) {
}
@Override
public void onSectionChanged(IndicatorSeekBar seekBar, int thumbPosOnTick, String textBelowTick, boolean fromUserTouch) {
//only callback on discrete series SeekBar type.
}
@Override
public void onStartTrackingTouch(IndicatorSeekBar seekBar, int thumbPosOnTick) {
}
@Override
public void onStopTrackingTouch(IndicatorSeekBar seekBar) {
}
});
onSectionChanged: when the SeekBar type is discrete series
, this callback work to get the tick position and text. continuous series
will not work.
Star to support me , many thanks!
Feel free to contact me if you have any trouble on this project.
- Create an issue.
- Send mail to me, "warkiz".concat("4j").concat("@").concat("gmail.com")
material.io-slider MaterialDesignLibrary PointerPopupWindow SeekBarCompat BubbleSeekBar android-slidr