RippleEffectLayout高仿Android 5.0 Ripple效果

这个效果是个老效果了,不过这种水波纹Ripple只能在Android 5.0以上才能支持,要向下兼容少不了。网上找了一些感觉好用的不多,于是自己写了一个。

这个效果原理很简单,只要确定点击的位置,然后做一个圆圈放大的效果。还有一点,点击layout后可以直接触发在它里面的view的点击事件。

在使用时,设置圆形的最小半径和最大半径,还有颜色,透明度。useCenter属性是指,是否使用布局自身的中心点作为中心来显示ripple效果,false时就是用手指点击的位置作为中心点。


<com.arjinmc.rippleeffectlayout.RippleEffectLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:minRadius="100"
    app:maxRadius="800"
    app:colorAlpha="0.2"
    app:color="#000000"
    app:useCenter="true"
    android:padding="16dp">
    <CheckBox
        android:id="@+id/check"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ATTENTION!"
        />
</com.arjinmc.rippleeffectlayout.RippleEffectLayout>

代码比较简单,不详细介绍了。具体看源码吧。

源码地址:https://github.com/arjinmc/RippleEffectLayout

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值