How can I set a custom seekbar's ProgressDrawable size to be smaller than the ProgressBackground

for change height progress drawble just add android:minHeight="2dp" and android:maxHeight="2dp" to layout.

UPDATE:

<androidx.appcompat.widget.AppCompatSeekBar
    android:id="@+id/seekBar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:paddingLeft="0dp"
    android:paddingRight="0dp"
    android:paddingTop="8dp"
    android:paddingBottom="8dp"
    android:max="100"
    android:minHeight="2dp"
    android:maxHeight="2dp"
    android:background="@android:color/transparent"
    android:progressDrawable="@drawable/sb_progress_drawable"
    android:progress="0"
    android:secondaryProgress="0"
    android:thumbOffset="0dp"
    android:thumb="@drawable/sb_thumb" />

sb_progress_drawable.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item android:id="@android:id/background">
        <shape android:shape="rectangle">
            <solid android:color="#26FFFFFF"/>
        </shape>
    </item>

    <item android:id="@android:id/secondaryProgress">
        <scale
            android:scaleWidth="100%" >
            <shape android:shape="rectangle">
                <solid android:color="#26FFFFFF"/>
            </shape>
        </scale>
    </item>

    <item android:id="@android:id/progress">
        <scale
            android:scaleWidth="100%" >
            <shape android:shape="rectangle">
                <solid android:color="#FFFFFF"/>
            </shape>
        </scale>
    </item>

</layer-list>

sb_thumb.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
    <size android:width="20dp" android:height="20dp" />
    <solid android:color="#FFFFFF" />
</shape>

    <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:id="@android:id/background">
        <shape android:shape="rectangle">
            <corners android:radius="20dp"/>
            <solid android:color="@color/fofo_grey" />

        </shape>
    </item>

    <item android:id="@android:id/progress">

        <clip>
            <shape android:shape="rectangle">
                <corners android:radius="20dp"/>
                  <solid android:color="@color/signup_green" />
                <stroke android:width="6dp"
                        android:color="@color/fofo_grey" />
            </shape>
    </clip>
    </item>

</layer-list>

just add stroke attribute in seekbar drawable


Managed to fix this. Can't believe it took me so long to think of the solution...

<clip>
    <shape android:shape="rectangle">
        <stroke android:color="@color/fofo_grey" android:width="6dp"/>
        <corners android:radius="20dp" />
        <solid android:color="@color/signup_green" />
    </shape>
</clip>

Added a stroke with the same colour as the background element, and tweaked the stroke width to achieve the desired effect.

Finished effect