How To Make Custom Thumb seekbar in Android Studio

--

Let’s make custom seekbar in android

We can change thumb in condition enable and disable, and dont worry about default theme disable from android resource

first make icon thumb drawable using this code, make name ic_thumb_seekbar.xml in res/drawable

<vector xmlns:android=”http://schemas.android.com/apk/res/android"
android:width=”@dimen/dimens_12dp”
android:height=”@dimen/dimens_12dp”
android:viewportWidth=”7"
android:viewportHeight=”7">
<path
android:pathData=”M3.5,3.5m-3.5,0a3.5,3.5 0,1 1,7 0a3.5,3.5 0,1 1,-7 0"
android:fillColor=”#101D2A”/>
</vector>

And make file xml in drawable again for control when disable and enable thumb, with name thumb_seekbar_custom_control

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_thumb_seekbar_disable" android:state_enabled="false"/>
<item android:drawable="@drawable/ic_thumb_seekbar"/>
</selector>

And finally, add custom control to property name thumb in view seekbar where you want

<SeekBar
android:id="@+id/seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:progress="0"
android:thumb="@drawable/thumb_seekbar_custom_control"
tools:progress="50" />

--

--