Search code examples
androidtouchseekbar

Make Seekbar thumb easier to grab


So I have a SeekBar but the little circle thumb thing is kind of hard to grab. Is there a way to make the hitbox larger? I don't necessarily care if the graphic itself looks any different -- I just want it to be grabbable.


Solution

  • You can customize the seekbar, Answered by Andrew, by changing the size of the Thumb. create layered-drawable with shape as placeholder thumb_image.xml

    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <shape>
            <size
                android:height="40dp"
                android:width="40dp" />
    
            <solid android:color="@android:color/transparent" />
        </shape>
    </item>
    <item android:drawable="@drawable/scrubber_control_normal_holo"/>
    </layer-list>
    

    The example shows the result below.

    <SeekBar
    android:id="@+id/seekBar1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:thumb="@drawable/thumb_image" />
    

    Another good example here of Thumb customization.