Just a simple custom switch, feel free to use/copy.
CustomSwitchDemo.mp4
<com.hoffmann.emilio.custom_switch.CustomSwitch
android:id="@+id/mainSwitch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:firstOption="@string/first_option"
app:secondOption="@string/second_option" />
binding.mainSwitch.setSwitchChangedListener {
if (it == CustomSwitch.SwitchSelected.FIRST) {
...
} else {
...
}
}