CoolSwitch

介绍:

一个自定义的带有reveal动画的滑动开关控件

运行效果:

使用说明:

将switch控件添加到布局中,同时指定disabled和enabled两种状态下的view,如果任意一个没有指定,将不会有动画。

<com.serchinastico.coolswitch.CoolSwitch
    android:id="@+id/cool_switch_foo"
    android:layout_height="35dp"
    android:layout_width="60dp"
    coolswitch:disabledView="@id/disabled_view_foo"
    coolswitch:enabledView="@id/enabled_view_foo"/>

将动画view包裹在TargetFrameLayout或者TargetLinearLayout中:

<com.serchinastico.coolswitch.TargetFrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <LinearLayout
            android:id="@+id/disabled_view_foo"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#FF0000"/>
    <LinearLayout
            android:id="@+id/enabled_view_foo"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#00FF00"/>
</com.serchinastico.coolswitch.TargetFrameLayout>
已下载
0