Material 旋壓favorite/star 按紐:Material Favorite Button

Material 旋壓favorite/star 按紐

Demo Image

Gradle

allprojects {
    repositories { 
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
dependencies {
    compile 'com.github.ivbaranov:MaterialFavoriteButton:0.1.1'
}

Usage

Declare in XML (see xml attributes below for customization):

<com.github.ivbaranov.mfb.MaterialFavoriteButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

Or static initializer (see xml attributes below for customization):

MaterialFavoriteButton favorite = new MaterialFavoriteButton.Builder(this)
        .create();

Configure using xml attributes or setters in code:

app:mfb_animate_favorite="true"                 // to animate favoriting
app:mfb_animate_unfavorite="false"              // to animate unfavoriting
app:mfb_padding="12"                            // image padding
app:mfb_favorite_image="@drawable/ic_fav"       // custom favorite resource
app:mfb_not_favorite_image="drawable/ic_not_fav"http:// custom not favorite resource
app:mfb_rotation_duration="400"                 // rotation duration
app:mfb_rotation_angle="360"                    // rotation angle
app:mfb_bounce_duration="300"                   // bounce duration
app:mfb_color="black"                           // black or white default resources
app:mfb_type="star"                             // star or heart shapes

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

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