Request guidance for creating a custom SeekBar in Android. (as it shown on the picture)

I have a task to create a SeekBar as shown below:

enter image description here

My question is: how to segment a search engine? I used to make custom search lists, but I donโ€™t know how to segment such a bar, and the lines go beyond the height of the search.

I stumbled upon the ComboSeekBar library, but that doesn't help much.

Thanks in advance to everyone who wants to help!

Hooray!

+6
source share
2 answers

I already see two ways to do this

  • Using Drawable Background

    Create and select your search string using setBackgroundDrawable() .

  • Use third-party libraries:

RangeSliderView: (minimum API SDK 14):

https://github.com/channguyen/range-slider-view

enter image description here

RangeSeekbar:

https://github.com/dolphinwang/RangeSeekbar

RangeBar:

https://github.com/edmodo/range-bar

Check also this unfinished project: https://github.com/feelinglucky/RadioSeekBar

Hope this helps

+3
source

For anyone who needs to create a similar Seekbar like me:

This library was exactly what I needed, except for the fact that it has 2 thumbs, and in no way eliminate one of them.

https://github.com/edmodo/range-bar

enter image description here

I developed a bit of a โ€œhackโ€ for this: when you initialize the Range-Bar, you can set the thumb indices using this method, as stated on the wiki:

 RangeBar rangebar = (RangeBar) findViewById(R.id.rangebar); rangebar.setThumbIndices(5,5); //indices example 

And when the index of the thumb changes, in the following method you set the thumbs in one position:

 rangebar.setOnRangeBarChangeListener(new RangeBar.OnRangeBarChangeListener() { @Override public void onIndexChangeListener(RangeBar rangeBar, int leftThumbIndex, int rightThumbIndex) { //Code using the leftThumbIndex and rightThumbIndex to update the index values. rangeBar.setThumbIndices(leftThumbIndex, leftThumbIndex); } }); 

Hope this will be helpful to everyone.

Thank you all for your help!

Hooray!

0
source

All Articles