Skip to content Skip to sidebar Skip to footer

Remove Seekbar Shadow

I'm getting a random shadow behind my SeekBar and thumb for some strange reason (the dark but not the black part). How do I get rid of it? My SeekBar:

Solution 1:

Try this:

    <SeekBar android:layout_width="fill_parent"
        android:layout_height="wrap_content"
/////
        android:background="@null"
/////
        android:id="@+id/slider"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:max="10"
        android:thumb="@drawable/thumb"
        android:progressDrawable="@drawable/progress_appearance"/>

Solution 2:

I used this code:

<SeekBar
    android:id="@+id/seekbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:max="100"
    android:background="@null"
    android:padding="0dp"
    android:progressDrawable="@drawable/progress_seekbar"
    android:thumb="@android:color/transparent" />

It worked for me.

Solution 3:

Add this property in Seekbar

android:splitTrack="false"

Solution 4:

I was facing a similar problem. After some struggling, I figured out that the shadow doesn't appear when it has something behind it. So I finally put a white FrameLayout behind SeekBar.

The weird shadow

Here's my code.

<FrameLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"><!-- Putting this FrameLayout, I could remove the shadow. --><FrameLayoutandroid:background="@android:color/white"android:layout_width="match_parent"android:layout_height="match_parent" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><FrameLayoutandroid:layout_width="match_parent"android:layout_height="70dp"><LinearLayoutandroid:orientation="horizontal"android:layout_width="match_parent"android:layout_height="match_parent"><!-- Thumbnail frames you see above --><ImageViewandroid:layout_width="0dp"android:layout_height="match_parent"android:layout_weight="1"/>
            ...
        </LinearLayout><!-- The SeekBar --><SeekBarandroid:padding="0dp"android:layout_width="match_parent"android:layout_height="match_parent" />
        ...

It is very weird because, I didn't put anything front of the shadow but behind the shadow. I think this is Android's bug.

I hope it helps you :)

Post a Comment for "Remove Seekbar Shadow"