here is a small example of how to change swicth width, I hope this helps someone ...
1) Use cheers for thumb (color_thumb.xml)
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <size android:height="40dp" /> <gradient android:height="40dp" android:startColor="#FF569BDA" android:endColor="#FF569BDA"/>
2) gray color for the track (gray_track.xml)
shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <size android:height="40dp" /> <gradient android:height="40dp" android:startColor="#dadadada" android:endColor="#dadadada"/>
3) Thumb Selector (thumb.xml)
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:drawable="@drawable/gray_track" /> <item android:state_pressed="true" android:drawable="@drawable/color_thumb" /> <item android:state_checked="true" android:drawable="@drawable/color_thumb" /> <item android:drawable="@drawable/gray_track" />
4) Track selector (track.xml)
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:drawable="@drawable/color_thumb" /> <item android:drawable="@drawable/gray_track" />
and finally in the switch
use
android:switchMinWidth="56dp" android:thumb="@drawable/thumb" android:track="@drawable/track"
source share