Android两个大拇指的Seekbar

这个问题的变化可以在互联网上find,但不是一个答案。

我想要一个双拇指范围select的seekbar。 我愿意自己编程,但我缺乏Android的经验。 有人能给我一些指导从哪里开始。 我的意思是,我知道我将不得不扩展一些东西(可能是ProgressBar),但我应该怎么做呢? 我真的必须重新创build一个标准的seekbar的所有function,还是有一个更简单的方法?

完整的解决scheme当然也是受欢迎的;)

我也在寻找这个,无济于事。 所以我做了一个新的小部件,随时使用它: https : //github.com/anothem/android-range-seek-bar

RangeSeekBar的截图

“我也在寻找这个,无济于事。所以我做了一个新的小部件,随时使用它: https : //code.google.com/p/range-seek-bar/ ”

这个例子Stephan链接作品太棒了! 但是,用户必须按任何一个大拇指才能得到一个响应。 我想,如果用户按下栏,最近的拇指会移动到该位置,像正常工作。

我在示例代码中实现了这一点:

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

而在“ public boolean onTouchEvent(MotionEvent event) ”,

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

带有左右图标的窗口式search栏。
可预设的最小窗口大小和自动反交叉。

windowed-seek-bar的屏幕截图

Mercurial存储库,位于https://bitbucket.org/nimbusgb/windowed-seek-bar

我使用了anothem / android-range-seek-bar库

https://github.com/anothem/android-range-seek-bar

在xml中

 <org.florescu.android.rangeseekbar.RangeSeekBar android:id="@+id/pricebar_with_label" android:layout_width="match_parent" android:layout_height="wrap_content" rsb:absoluteMinValue="20" rsb:absoluteMaxValue="150" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" /> 

在这里输入图像说明