波纹

RippleEffect

属性

  • app:rv_alpha [integer def:90 0-255]
    波纹透明度
  • app:rv_framerate [integer def:10]
    波纹动画帧速率
  • app:rv_rippleDuration [integer def:400]
    波纹动画时长
  • app:rv_ripplePadding [dimension def:0]
    波纹间距
  • app:rv_color [color def:@android:color/white]
    波纹色
  • app:rv_centered [boolean def:false]
    Center ripple in the child view
  • app:rv_type [enum (simpleRipple, doubleRipple) def:simpleRipple]
    波纹类型
  • app:rv_zoom [boolean def:false]
    缩放否
  • app:rv_zoomDuration [integer def:150]
    缩放时长
  • app:rv_zoomScale [float def:1.03]
    缩放比例

使用

依赖

dependencies {
    compile 'com.github.traex.rippleeffect:library:1.3'
}

布局

<com.andexert.library.RippleView
    android:id="@+id/rvServiceCommentRecord"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:rv_color="@color/colorPrimary"
    app:rv_framerate="15"
    app:rv_rippleDuration="150"
    app:rv_type="doubleRipple">

    <ImageView       
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="@string/toDo"
        android:src="@drawable/record_normal" />
</com.andexert.library.RippleView>

If you want to know when the Ripple effect is finished, you can set a listener on your view.

rippleView.setOnRippleCompleteListener(new RippleView.OnRippleCompleteListener() {

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

If you want to add an OnClickListener don’t forget to add it to the RippleView.

final RippleView rippleView = (RippleView) findViewById(R.id.rippleView);
rippleView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        //TODO: onRippleViewClick
    }
});

猜你喜欢

转载自blog.csdn.net/zsp_android_com/article/details/80714914
今日推荐