1

Here is my seekbar

    <SeekBar
    android:thumb="@drawable/thumb"
    android:progressDrawable="@android:color/transparent"
    android:background="@android:color/transparent"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

Here is it's thumb:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@android:drawable/status_bar_item_app_background">
        <shape android:shape="rectangle">
            <solid android:color="@color/white"/>
            <size android:width="5dp"/>
        </shape>
    </item>
</selector>

When seekbar is clicked it become yellow. I want it to not change. How do I do that?

Ilya Gazman
  • 31,250
  • 24
  • 137
  • 216

1 Answers1

0

You are using selector in wrong way. You are forgetting to put state. Follow this pattern:

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/red_scrubber_control_disabled_holo" android:state_enabled="false"/>
    <item android:drawable="@drawable/red_scrubber_control_pressed_holo" android:state_pressed="true"/>
    <item android:drawable="@drawable/red_scrubber_control_focused_holo" android:state_selected="true"/>
    <item android:drawable="@drawable/red_scrubber_control_normal_holo"/>
</selector>

Source

Good luck!

Community
  • 1
  • 1
Bipin Bhandari
  • 2,694
  • 23
  • 38
  • I used my item and copy it 4 times to add those states. But it did not worked out. I think that if you do not provide the extra states it should just use one state. – Ilya Gazman Mar 24 '15 at 01:02
  • Right now just try commenting your xml and replacing with this one. It should work. – Bipin Bhandari Mar 24 '15 at 01:05