3

I want to make a seekbar thumb completely invisible. However, the following code:

seekBar.getThumb().mutate().setAlpha(0);

makes the thumb not appear, but the thumb appears to make a "hole" in its seekbar, as shown in the image below.

Seekbar with split track

How can one make a thumb invisible without it leaving a gap under it?

M.S.
  • 1,091
  • 1
  • 11
  • 27
  • Kindly refer this link: http://stackoverflow.com/questions/27415918/seek-bar-thumb-not-transparent-in-android-5-0-api-21-lollipop/27540406#27540406 – Ankit Agrawal Mar 10 '16 at 07:58

2 Answers2

6

The solution is very simple.

In the seekbar's XML layout, add the following:

android:splitTrack="false"

Alternatively, your can programatically call:

seekbar.setSplitTrack(false);

The end result looks like this:

Seekbar without split track

M.S.
  • 1,091
  • 1
  • 11
  • 27
0

Use this for LOLLIPOP and newer, while in older version splitTrack=false by default

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    seekbar.setSplitTrack(false);
}
DoubleK
  • 542
  • 3
  • 16