Android的Material风格Switch控件:Material Animated Switch
jopen
9年前
一个material Switch 控件支持ico动画和颜色变换。
使用说明:
默认
<com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch android:id="@+id/pin" android:layout_width="wrap_content" android:layout_height="wrap_content" />
自定义颜色和图表
<com.github.glomadrian.materialanimatedswitch.MaterialAnimatedSwitch android:id="@+id/pin" android:layout_width="wrap_content" android:layout_height="wrap_content" app:base_release_color="@color/md_deep_orange_900" app:base_press_color="@color/md_deep_orange_50" app:ball_release_color="@color/md_deep_orange_500" app:ball_press_color="@color/md_white_1000" app:icon_release="@drawable/ic_play_arrow_white_36dp" app:icon_press="@drawable/ic_stop_deep_orange_500_36dp" />
记得添加
xmlns:app="http://schemas.android.com/apk/res-auto"
Gradle配置
添加repository
repositories { maven { url "http://dl.bintray.com/glomadrian/maven" } }
添加依赖
compile 'com.github.glomadrian:MaterialAnimatedSwitch:1.0@aar'