Toggle Switch Like UI component for Android.
Add maven repository into your build.gradle:
repositories {
...
jcenter()
...
}
Add dependency into your application-level build.gradle
dependencies {
...
implementation "jp.pocket7878.switcherview:switcherview:1.0.2"
...
}
Add view into your layout:
<jp.pocket7878.switcherview.SwitcherView
app:sv_background_color="@color/white"
app:sv_leftmost_hover_color="@color/primary"
app:sv_rightmost_hover_color="@color/alert"
app:sv_left_choice_icon_src="@drawable/ic_good"
app:sv_left_choice_text="@string/switcher_good_text"
app:sv_right_choice_icon_src="@drawable/ic_discontent"
app:sv_right_choice_text="@string/switcher_discontent_text"
app:sv_disable_choice_tint_color="@color/icon_default"
app:sv_enable_choice_tint_color="@color/white"
/>switchToLeftChoice(): Select left choice programatically.switchToRightChoice(): Select right choice programatically.setOnSwitchSelectChangeListeneronLeftChoiceSelected()onRightChoiceSelected()onStartSwitchUserControl(): Called when user start interact with hover.onFinishSwitchUserControl(): Called when user finish interact with hover.
