For learning purposes, I want to implement an HSV color picker like this:
I know that I'll be using SeekBar
s, but how can I show those gradients in the bar of the SeekBar
.
How do I show the 7 color spectrum in the bar, like the first one shown in the image?
How do I show the linear gradient from white to a specific color? And how do I show the linear gradient from black to a specific color?
I am not asking for code, just for rough outline of steps to go about it?
SeekBar
indirectly extends ProgressBar
, which has a method by the name of setProgressDrawable(Drawable d)
, to draw that bar as the Drawable
you pass into it as its argument.
You will have to implement your own custom ShapeDrawable
(probably a RectShape
) to give the gradient you want. See the Android Graphics and Drawables guide and classes around Shader, e.g. LinearGradient.