2

The range of my seekbar is between (-100,100) and the thumb starts on 0 (in the middle of the seekbar). I want to the progress tint starts at middle. With this library, the progress tint starts always in the beginning of the seekbar.

I used this library, with the ticks. https://github.com/warkiz/IndicatorSeekBar

enter image description here

My xml.

enter image description here

And my kotlin code:

mBinding.seekbarWorkout.customSectionTrackColor { colorIntArr ->
            for (i in 0..9) {
                colorIntArr[i] = resources.getColor(R.color.white_transparent, null)
            }

            true //true if apply color , otherwise no change
        }

mBinding.seekbarWorkout.onSeekChangeListener = object : OnSeekChangeListener {
            override fun onSeeking(seekParams: SeekParams?) {}

            override fun onStartTrackingTouch(seekBar: IndicatorSeekBar?) {}
            override fun onStopTrackingTouch(seekBar: IndicatorSeekBar?) {
                updateViewModel()
            }
        }

The track progress color must starts in the middle of the seekbar. I want something like this:

enter image description here

Hernâni Pereira
  • 312
  • 4
  • 19

2 Answers2

0

Tried in demo and working fine.

    <com.warkiz.widget.IndicatorSeekBar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:isb_progress="0" // this property is your solution
        app:isb_min="-100"
        app:isb_max="100"
        app:isb_tick_marks_size="3dp"
        app:isb_ticks_count="5" />

For me this code worked fine if its still not working then rather then implementing library and copy that IndicatorSeekBar class to understand it better.

haresh
  • 1,424
  • 2
  • 12
  • 18
0

There is no native way to do that. The only way to do this:

solution

Hernâni Pereira
  • 312
  • 4
  • 19