Android SeekBar icon where the values ​​are located

I have a SeekBar with 3 values ​​(left, center and right), and I would like to add some mark where the progess level, for example. in the center to put a vertical line above the bar or something like that.

Is this possible, or could it be better to use some other component?

Like in this image, I need something like this red line

+6
source share
2 answers

You can use setBackgroundDrawable (Drawable d). Save the image of what you want the labels to be in the png image, and then add it to your resources in your project.

Here is some code that I used where my image was an android launch icon:

seekbar = (SeekBar) findViewById(R.id.seekBar1); Resources r = getResources(); Drawable d = r.getDrawable(R.drawable.ic_launcher); seekbar.setBackgroundDrawable(d); 
+2
source

If someone comes to this question now: Meanwhile, there is a discrete SeekBar that does exactly what has been called into question: it displays discrete points that can be selected as labels.

-1
source

Source: https://habr.com/ru/post/900587/


All Articles