LikeButton使用分享

2018-02-28  本文已影响63人  面熟_gson

效果图:

github地址:https://github.com/jd-alexander/LikeButton

基本使用方法

Repository

添加在你的根build.gradle文件(不是你的模块build.gradle文件):

allprojects{

repositories {

...maven {

 url"https://jitpack.io"

}

}

}

添加到你的模块的build.gradle文件:

dependencies{

...

compile'com.github.jd-alexander:LikeButton:0.2.3'

}

然后直接在xml文件中

<com.like.LikeButton

    app:icon_type="Thumb"   //Thumb手点赞样式;Star五角星;heart爱心

    app:icon_size="15dp"

    android:id="@+id/star_button"

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"/>

java代码:

likeButton.setOnLikeListener(newOnLikeListener() {

@Override

publicvoidliked(LikeButtonlikeButton) { }@OverridepublicvoidunLiked(LikeButtonlikeButton) { } 

 });

上一篇 下一篇

猜你喜欢

热点阅读