0

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

Community
  • 1
  • 1
Imtiyaz Khalani
  • 2,037
  • 18
  • 32

2 Answers2

3

In my case, the android:paddingLeft and android:paddingRight not work. use android:paddingStart,android:paddingEnd instead

<SeekBar
android:layout_width="match_parent"
android:layout_height="@dimen/_49sdp"
android:background="@drawable/statelist_bg_redeem_slider"
android:max="100"
android:paddingEnd="@dimen/_46sdp"
android:paddingStart="@dimen/_46sdp"
android:progressDrawable="@null"
/>
Linh
  • 57,942
  • 23
  • 262
  • 279
Nguyen Minh Binh
  • 23,891
  • 30
  • 115
  • 165
1

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.

Elad Benda2
  • 13,852
  • 29
  • 82
  • 157