0

I have a problem with seekbars. They work without issues until I try and do the following:

seekBar.setProgressDrawable(getResources().getDrawable(R.drawable.seek_bar));

I even tried using a color only instead of a drawable resource. Same issue. The problem is when I do set the drawable, I see that the Seekbar drawable is a bit shorter (from start and end) and the thumb icon can go beyond it.

Also, I have noticed that the thumb icon itself has a white background surrounding it (not transparent). I even tried setting a vector drawable for the thumb, and the thumb went beyond the boundaries of seekbar (part of the thumb was hidden).

Could someone explain this behavior. I have tried searching for around three hours now without luck. I even tried the solution from:

How to set Android SeekBar progress drawable programatically

Which has the same issue for me.

Thank you.

Gautam Surani
  • 1,136
  • 10
  • 21

1 Answers1

0

To get rid of the non-transparent background I have used:

seekBar.setSplitTrack(false);

To make the thumb not go beyond the boundaries, I have shrunk the thumb. It is not perfect but it works.