55

API Level < 21

Thumb is transparent, as expected.

Screenshot taken on a Nexus 5 running Android 4.4.4

On API Level 21

Thumb is opaque, Wonder why.

Screenshot taken on a Nexus 5 running Android 5.0

Here is the code

 <SeekBar
                android:id="@+id/ui_audioplayer_progressbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:progressDrawable="@drawable/custom_progress_bar_horizontal"
                android:thumb="@drawable/stud_slider" />

Interestingly, this problem can be seen and reproduced in the xml preview in eclipse itself, when you change the API Level perspectives.

When API level 21 is selected

When API level 19 is selected

Note:

  • I run the same apk on both devices.
  • Both devices are of the same make and model, i.e Nexus 5.
  • The thumb image is a PNG with a transparent background, as apparent from the screenshot for API Level < 21

Is this a known bug in Lollipop or am i doing something wrong?

2
  • 5
    possible duplicate of Custom seekbar with style errors on API 21
    – alanv
    Dec 11, 2014 at 21:52
  • 1
    @alanv that is the same question. Thanks for pointing out. But the question title is not descriptive enough imo. Not editing that question, and keeping this here so people could reach the answer searching with either queries.
    – Vinay W
    Dec 18, 2014 at 9:27

2 Answers 2

155
<SeekBar
    ....
    android:splitTrack="false" 
/>
3
  • When I use the attribute, android:splitTrack = "false" in my SeekBar, I got an error, "No resource identifier found for attribute 'splitTrack' in package 'android'". Please help me. Jul 25, 2015 at 11:53
  • 3
    Ohh got it :). When I set target API level to 21 the issue solved. Jul 25, 2015 at 12:11
  • 2
    how did you figure this out?
    – Ryhan
    Jul 12, 2016 at 20:22
12

For all API levels,

<Seekbar
    .....
    android:background="@null"
    android:splitTrack="false"
    ....
 />

will work. It worked for me.

1
  • Saved my day +1, also worked on android drawable which was implemented on imageview , so set imageview background as @null
    – sanjeeb
    Nov 14, 2019 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.