All Versions
Latest Version
Avg Release Cycle
Latest Release

Changelog History

  • v2.1.0 Changes


    1. Migrate to maven central


    1. 迁移到 maven central
  • v2.0.3 Changes


    👍 1. Fix #103. Determin whether state change is triggered manully using isPressed in OnCheckedChangeListener is supported. 🚚 2. Remove targetSdkVersion declaration.

    1. Upgrate compileSdkVersion to 29.


    1. 修复 #103。支持在OnCheckedChangeListener中使用isPressed判断是否是手动触发。
    2. 移除targetSdkVersion声明
    3. 更新compileSdkVersion到29
  • v2.0.2 Changes


    👍 1. Fix #122. Support sub-class extending from SwitchButton. 🚚 2. Fix bug which move faster than expected while touch and move vertically. 🚚 3. Remove dependency of AppCompat library.


    1. 修复 #122。支持从SwitchButton集成子类。
    2. 修复纵向滑动导致移动过快的Bug。
    3. 移除对AppCompat库的依赖。
  • v2.0.0 Changes


    1. Re-clarify the meaning of some params. ⚡️ 2. Update the measurement of SwitchButton and the logic becomes more clear, especially the text part. 👍 3. Support config SwitchButton's size by setting a exact width and height. There are now TWO mainly method to control it's size.


    1. 重新明确了参数的含义。
    2. 更新了SwitchButton的测量机制,逻辑更加清晰;尤其是文字部分。
    3. 支持设置确定的宽高,来确定SwitchButton的View大小。现在有两种方式可以控制SwitchButton的大小了。
  • v1.4.6 Changes

    • 🛠 Fixed #89 .
  • v1.4.5 Changes


    • 🛠 Fixed #65.
    • ⚡️ Update text layout, tests looks like center.


    • 🛠 Fixed #64. Respect to clickable and focusable attributes.


    • Support #49. By default SwitchButton found accentColor of your theme for tintColor. (accentColor is used for controls according to Material Design guideline. )


    • 🛠 fixed #49.
    • 👌 Support operation without onCheckedChanged callback.


    • Add text feature. You can set text for either checked or unchecked status with kswTextOn and kswTextOff attrs. And you can set the margin of text in horizontal direction using kswTextMarginH attr.
    • For additional, you can set small icons now by using SpannableString with setText() method in code.
    • Thanks @lpmfilho



    • 🛠 Fix SwitchButtonMD style bug in RecyclerView and add page for test. Fix bug in setCheckedImmediately() in onCheckedChanged() method. *(setChecked in onChecked)**


    • setClickable(boolean) support.
      • Bug fix.


    • ✂ Remove shadow of MD style to support under 5.0.


    • Reconstructe the whole library.
      • More convenient customization way by tintColor.
      • New design demo. All APIs in ONE. *Fix issue #23 #25 #26 *Just exciting!!!


    • 🛠 Fix issue #22 by change the attributes' name to prevent conflict;


    • 🛠 Fix issue #19.


    • 🛠 Fix stretch bug while using higher API. *Add Gradle support. *Built in Android Studio.


    • 🛠 Fix rendering bug on some devices. *Fix states bug.


    • With calling the method setChecked(boolean, false);, you can change the status without invoking the listener.


    • 🛠 Fix shrink bug in Android 5.0 (the problem is same like it is in Android 4.4, which has been fixed in 1.2.4). *More available to setup Material Design style SwitchButton using @style/MD in xml layout. *Fix Demo Project bug


    • fix shrink bug(that will cause the content out of bounds not disapper, on Android 4.4)
    • upload .pad resource, whitch I forgot to upload before.(My fault.)


    • bug fix
    • ⬆️ upgrade demo apk
    • more clear way to use

    Since the animation ran on sub thread, "toggle" and "setChecked" methods may mot execute as you wish what cause the checked status change immediately.

    This problem may be solved, but I declared 2 methods to deal with the situation whether you want it happen immediately.

    If you want to set the checked status immediately, just call setChecked(boolean checked); method like CheckBox. And slideToChecked(boolean checked); method for slow one with slide animation.

    When toggle, call toggle(); with change the status immediately and toggle(false); for slow one.




    • ➕ Add StateList support for all resources and enable/disable, pressed has been tested in Demo.
    • New Style with Material Design, preview below.
    • ➕ Add "shrink" feature. This makes you can draw your image resources out size the view bounds, in the other word, shrink the size of view and make the experience stay the same.

    🆕 New Style with Material Design:

    💅 materialdesign_style

    To use shrink feature, you can easily add these attributes in your xml file. It is recommended that set these values positive.

    • insetLeft: left size for shrinking
    • insetRight: right size for shrinking
    • insetTop: top size for shrinking
    • insetBottom: bottom size for shrinking



    • 🛠 Fix lots of bugs.
    • 💅 Change the default style
    • ➕ Add iOS7 style, you can just use like how the demo did
    • ⚡️ Update demo, it becomes more convenient, effective and beautiful
    • ➕ Add new attribute: measureFactor, you can custom the factor between width and height now. It is convenient to config the rest space of background. Learn more in the demo.
    • 💅 Update the logic of thumbMargin, it can work well with negative margins now (iOS style just using this trick).

    🆕 new default style and demo apk looks like this:

    💅 default_style



    ➕ Add an attr of radius, now you can change the radius when configure the button's face!