android 新浪微博的点赞功能实现,Android点赞效果的实现

先看下点赞的效果图

01b1a89bf4d03f551bdfe318a8175576.png

首先添加依赖

api 'com.sackcentury:shinebutton:0.2.0'

xml布局

看下属性说明:

属性

Java方法

描述

siShape

void setShapeResource(int)

设置原始资源(png)

btn_color

void setBtnColor(int)

设置原点颜色

btn_fill_color

void setBtnFillColor(int)

单击后设置填充颜色

allow_random_color

void setAllowRandomColor(boolean)

允许光泽颜色随机

shine_animation_duration

void setAnimDuration(int)

设置光泽动画持续时间

big_shine_color

void setBigShineColor (int)

设置大光泽的颜色

click_animation_duration

void setClickAnimDuration(int)

设置单击动画持续时间

enable_flashing

void enabaleFlashing (boolean)

启用闪光效果

shine_count

void setShineCount (int)

按钮周围设置闪耀计数

shine_distance_multiple

void setShineDistanceMultiple (float)

设置距离按钮的多个距离

shine_turn_angle

void setShineTurnAngle(float)

设置光泽的转角

shine_size

void setShineSize (int)

按像素设置光泽大小

small_shine_color

void setSmallShineColor(int)

设置小亮泽颜色

small_shine_offset_angle

void setSmallShineOffAngle(float)

将小光泽的角度偏移设置为大光泽

初始化控件:

public class MainActivity extends AppCompatActivity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

ShineButton btLike = (ShineButton) findViewById(R.id.bt_like);

btLike.init(this);

ShineButton btSmile = (ShineButton) findViewById(R.id.bt_smile);

btSmile.init(this);

ShineButton btHeart = (ShineButton) findViewById(R.id.bt_heart);

btHeart.init(this);

ShineButton btStart = (ShineButton) findViewById(R.id.bt_star);

btStart.init(this);

}

}

github链接:

https://github.com/ChadCSong/ShineButton

另外github上一些优秀的开源项目,纯干货分享链接:

https://blog.csdn.net/yun382657988/article/details/83303147

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值