Search code examples
androidxmlandroid-custom-view

Customising Seekbar in Android is not working fine


i am customising seekbar in android here bolow is my code

process.xml

<item
    android:id="@android:id/background"
    android:drawable="@drawable/seek_bar_bg_new"/>
<item android:id="@android:id/progress">
    <clip
        android:drawable="@drawable/seek_bar_bg_fill_new"
        android:paddingLeft="10dp"
        android:paddingRight="10dp" />
</item>

AND MY SEEKBAR IN LAYOUT XML

<SeekBar
           android:id="@+id/seekbar_education_plan_investment_duration"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:layout_margin="0dp"
           android:progressDrawable="@drawable/process"
           android:thumb="@drawable/thumb" />

OUTPUT :- enter image description here

and when progress=50 enter image description here

it working fine between progress=3 to progress=98 it is not looking well from left and right side paddingLeft/Right is not working i have try THIS , THIS , and THIS too please help me thanx in advace


Solution

  • Adjust the android:paddingLeft, android:paddingRight and android:thumbOffset properties of your SeekBar to achieve desired results.

    Padding right and left should be half of thumbs width.