Android Seekbar with two thumbs

Solution 1:

I too was looking for this, to no avail. So I made a new widget, feel free to use it: https://github.com/anothem/android-range-seek-bar

Screenshot of RangeSeekBar

Solution 2:

"I too was looking for this, to no avail. So I made a new widget, feel free to use it: https://code.google.com/p/range-seek-bar/"

This example Stephan linked works great! However, the user has to press any of the thumbs to get a respons. I wanted that if the user pressed the bar, the closest thumb would move to that position and work like normal.

I implemented this in the example code like this:

private final Thumb getClosestThumb(float touchX)

{
    double xValue = screenToNormalized(touchX);        
    return (Math.abs(xValue - normalizedMinValue) < Math.abs(xValue - normalizedMaxValue)) ? Thumb.MIN : Thumb.MAX;
}

And in the "public boolean onTouchEvent(MotionEvent event)",

if(pressedThumb == null),
   pressedThumb = getClosestThumb(mDownMotionX);