Thanks to Paul Tsupikoff, Fatal1ty2787 and Ramesh for this excellent code.
Personally, I wanted a vertical slider that is upside-down compared to the given code. In other words, the value increases, rather than decreases, the lower the thumb. Changing four lines seems to have taken care of this.
First, I changed the
onDraw() method as originally given by Paul. The
translate() calls now have these arguments:
Then I made two changes to the
ACTION_MOVE case in
onTouchEvent() as given by Fatal1ty2787. The call to
setProgress() now looks like this:
setProgress((int) (getMax() * event.getY() / getHeight()));
Finally, the call to
onProgressChanged() looks like this:
myListener.onProgressChanged(this, (int) (getMax() * event.getY() / getHeight()), true);
Now, if only Google shared our interest in this feature....