Search code examples
androidseekbar

Android SeekBar with Thumb BELOW the bar


I'm trying to implement a Seek Bar following the design of the art team. They want a thumb that is not centered vertically, but rather below the progress bar (I would post a picture, but I don't have enough reputation yet to do it). I have been playing with the attributes like the thumbOffset that controls the horizontal offset, but I haven't been able to find anything to indicate a vertical offset or padding. As a result, I'm only able to get a seek bar where the thumb is centered vertically.

I have also tried to extend SeekBar but the method that is calculating the thumb position is private. Does anyone have a solution other than implement a completely new seek bar component from scratch?

Thanks.


Solution

  • Here's an idea(I haven't tried it), make a seek bar below the one which you want the user to move, and make it invisible with VIEW.INVISIBLE. Then, in the invisible seek bar's onSeekBarChangedListener, set the first visible seek bar to the value that the second seek bar is on. And finally give the first seekbar the setFocuseable(false) , so that the user doesnt move the seek bar from the wrong place. If this doesn't make sense or work tell me and I will revise/delete this.