Seek Bar thumb not transparent in Android 5.0 API 21 Lollipop

AndroidTransparencyAndroid 5.0-Lollipop

Android Problem Overview


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?

Android Solutions


Solution 1 - Android

<SeekBar
    ....
    android:splitTrack="false" 
/>

Solution 2 - Android

For all API levels,

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

will work. It worked for me.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionVinay WView Question on Stackoverflow
Solution 1 - AndroidFedorView Answer on Stackoverflow
Solution 2 - AndroidYogesh GuptaView Answer on Stackoverflow