I have SeekBar with 3 value (left, on center and right) and I will like to put some mark where progess level are, e.g. on center to put vertical line over bar or something like that.
Is this possible or it's might be better to use some different component?
Like on this image, I need something like this red line
Now go to the activity_main. xml create a layout and inside the layout add a SeekBar. Specify the height width of SeekBar and the max progress that you want to use set progress to 0. This will create a customized Seekbar inside activity_main.
A SeekBar is an extension of ProgressBar that adds a draggable thumb. The user can touch the thumb and drag left or right to set the current progress level or use the arrow keys. Placing focusable widgets to the left or right of a SeekBar is discouraged.
Just add android:thumbTint="@color/yourColor" in your seekbar.
You are looking for the method getProgress() of the ProgressBar class as SeekBar is a subclass of ProgressBar . So basically it would be something like that. int value = seekBar. getProgress();
You can use the setBackgroundDrawable(Drawable d). Save an image of what you want the labels to be in a png image then add it to your resources in your project.
Here is some code I used, where my image was the android launcher icon:
seekbar = (SeekBar) findViewById(R.id.seekBar1);
Resources r = getResources();
Drawable d = r.getDrawable(R.drawable.ic_launcher);
seekbar.setBackgroundDrawable(d);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With