【开源】CoolSwitch

CoolSwitch

使用说明:

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

1
2
3
4
5
6
<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中:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<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>

 

相关代码

  • SHSwitchView

posted on 2015-05-05 10:50  wasdchenhao  阅读(121)  评论(0)    收藏  举报

导航