Skip to content

Instantly share code, notes, and snippets.

@molidev8
Created November 17, 2022 19:05
Show Gist options
  • Save molidev8/f856f74d88f844835265486fa79beac5 to your computer and use it in GitHub Desktop.
Save molidev8/f856f74d88f844835265486fa79beac5 to your computer and use it in GitHub Desktop.
A custom track for a Switch view
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape android:shape="rectangle">
<solid android:color="@color/blue_300" />
<corners android:radius="40dp" />
<size android:width="48dp" android:height="24dp" />
</shape>
</item>
<item android:state_checked="false">
<shape android:shape="rectangle">
<solid android:color="@color/gray" />
<corners android:radius="40dp" />
<size android:width="48dp" android:height="24dp" />
</shape>
</item>
</selector>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment