Skip to content
forked from bitvale/Switcher

原项目的代码由kotlin+AndroidX实现,由于一些原因,本项目用java+support对其进行了重构。Android implementation of switch animation from Oleg Frolov

Notifications You must be signed in to change notification settings

Z-P-J/ZSwitcher

 
 

Repository files navigation

Switcher

sample

License Platform API

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

Read on Medium

USAGE

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

dependencies {
  implementation 'com.zpj.widget:ZSwitcher:1.0.5'
}

XML

<com.zpj.widget.switcher.CommonSwitcher
        android:id="@+id/switcher_x"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

<com.zpj.widget.switcher.CircleSwitcher
        android:id="@+id/switcher_c"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>

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

Properties:
  • android:checked (boolean) -> default true
  • app:switcher_on_color (color) -> default #48ea8b
  • app:switcher_off_color (color) -> default #ff4651
  • app:switcher_icon_color (color) -> default white
  • app:elevation (dimension) -> default 4dp

Java

switcher.setOnCheckedChangeListener(new OnCheckedChangeListener() {
    @Override
    public void onChange(boolean checked) {
        // do something
    }
});

LICENCE

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

About

原项目的代码由kotlin+AndroidX实现,由于一些原因,本项目用java+support对其进行了重构。Android implementation of switch animation from Oleg Frolov

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%