效果图:
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) { }
});
网友评论