Skip to content

Android implementation of checkbox switch animation from Oleg Frolov

Notifications You must be signed in to change notification settings

bitvale/CheckboxSwitcher

Repository files navigation

CheckboxSwitcher

sample

License Platform API

Created this switch animation from Oleg Frolov as an android library.

USAGE

Just add CheckboxSwitcher view in your layout XML and CheckboxSwitcher library in your project via Gradle:

dependencies {
  implementation 'com.bitvale:checkboxswitcher:1.0.0'
}

XML

<com.bitvale.checkboxswitcher.CheckboxSwitcher
    android:id="@+id/switcher"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:switcher_bg_color="@color/switcher_color"
    app:thumb_off_color="@color/off_color"
    app:thumb_on_color="@color/icon_color"
    app:thumb_icon="@drawable/thumb_icon" />

You must use the following properties in your XML to change your Switcher.

Properties:
  • android:checked (boolean) -> default false
  • app:switcher_height (dimension) -> default 26dp // width is calculated automatically
  • app:switcher_bg_color (color) -> default white
  • app:thumb_on_color (color) -> default #95cd75
  • app:thumb_off_color (color) -> default #e5e5e5
  • app:thumb_icon (reference) -> default check icon
  • app:elevation (dimension) -> default 4dp

Kotlin

switcher.setOnCheckedChangeListener { checked ->
    if (checked) action()
}

LICENCE

CheckboxSwitcher by Alexander Kolpakov is licensed under an Apache License 2.0.

About

Android implementation of checkbox switch animation from Oleg Frolov

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published