I'm trying to set a custom drawable as track to a switch, but when I do that, it makes the thumb fill the track instead of overflowing it.
Switch without custom drawable:
Switch with the custom drawable applied:
Expected:
Style of the switch:
<style name="switch_style">
<item name="android:track">@drawable/switch_track_selector</item>
<item name="android:thumb">@drawable/switch_thumb_selector</item>
</style>
Any idea?
You can achieve this using the SwitchComapt
instead of switch and changing the theme.
You can have a look on this question.
Edit
if you are using the support libraries then you don't need any specific them even,
Your SwichComapt
will be automatically as per your current theme.