I'm trying to show a simple color picker so that the user can select the color of a few texts... But every color picker I've found so far seems too complicated for my means. I wouldn't mind coding it myself if at least I had some idea of how.
Could anyone provide me with code for some simple color picker? Or point me in a direction for further research into how to code it?
Try this:
In xml use:
<SeekBar
android:id="@+id/seekbar_font"
android:layout_width="300dip"
android:layout_height="wrap_content"
android:layout_margin="10px"
android:max="100"
android:progress="50"></SeekBar>
In activity:
LinearGradient test = new LinearGradient(0.f, 0.f, 300.f, 0.0f,
new int[] { 0xFF000000, 0xFF0000FF, 0xFF00FF00, 0xFF00FFFF,
0xFFFF0000, 0xFFFF00FF, 0xFFFFFF00, 0xFFFFFFFF},
null, TileMode.CLAMP);
ShapeDrawable shape = new ShapeDrawable(new RectShape());
shape.getPaint().setShader(test);
SeekBar seekBarFont = (SeekBar)findViewById(R.id.seekbar_font);
seekBarFont.setProgressDrawable( (Drawable)shape );