android的水波纹点击效果

开源的水波纹效果RippleEffect

RippleEffect是一个继承自RelativeLayout的自定义控件,使用起来非常简单,只需要将其作为需要点击效果的父控件即可。

效果

使用方法

1.在Gradle文件中添加

compile 'com.github.traex.rippleeffect:library:1.3'

2.在xml中添加RippleView

<com.andexert.library.RippleView
  android:id="@+id/more"
  android:layout_width="?android:actionBarSize"
  android:layout_height="?android:actionBarSize"
  android:layout_toLeftOf="@+id/more2"
  android:layout_margin="5dp"
  rv_centered="true">

  <ImageView
    android:layout_width="?android:actionBarSize"
    android:layout_height="?android:actionBarSize"
    android:src="@android:drawable/ic_menu_edit"
    android:layout_centerInParent="true"
    android:padding="10dp"
    android:background="@android:color/holo_blue_dark"/>

</com.andexert.library.RippleView>

3.如果需要监听波纹效果的完成事件,可以设置一个监听事件。

rippleView.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {

    @Override
    public void onComplete(RippleView rippleView) {
        Log.d("Sample", "Ripple completed");
    }

});

4.一些自定义的属性

app:rv_alpha [integer def:90 0-255] --> Alpha of the ripple
app:rv_framerate [integer def:10] --> Frame rate of the ripple animation
app:rv_rippleDuration [integer def:400] --> Duration of the ripple animation
app:rv_ripplePadding [dimension def:0] --> Add a padding to the ripple
app:rv_color [color def:@android:color/white] --> Color of the ripple
app:rv_centered [boolean def:false] --> Center ripple in the child view
app:rv_type [enum (simpleRipple, doubleRipple) def:simpleRipple] --> Simple or double ripple
app:rv_zoom [boolean def:false] --> Enable zoom animation
app:rv_zoomDuration [integer def:150] --> Duration of zoom animation
app:rv_zoomScale [float def:1.03] --> Scale of zoom animation

5.开源地址
https://github.com/traex/RippleEffect

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值