Android的Material風格Switch控件:Material Animated Switch

一個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'

項目主頁:http://www.baiduhome.net/lib/view/home/1434528592208

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!