【开源】android-ripple-background

android-ripple-background

 

使用说明:

 

在xml添加RippleBackground ,并为RippleBackground放置你想要的内容,比如imageview:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<com.skyfishjy.library.RippleBackground
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/content"
    app:rb_color="#0099CC"
    app:rb_radius="32dp"
    app:rb_rippleAmount="4"
    app:rb_duration="3000"
    app:rb_scale="6">
    <ImageView
        android:layout_width="64dp"
        android:layout_height="64dp"
        android:layout_centerInParent="true"
        android:id="@+id/centerImage"
        android:src="@drawable/demoImage"/>
</com.skyfishjy.library.RippleBackground>

开始播放动画:

1
2
3
4
5
6
7
8
final RippleBackground rippleBackground=(RippleBackground)findViewById(R.id.content);
   ImageView imageView=(ImageView)findViewById(R.id.centerImage);
   imageView.setOnClickListener(new View.OnClickListener() {
       @Override
       public void onClick(View view) {
           rippleBackground.startRippleAnimation();
       }
   });

停止动画:

1
rippleBackground.stopRippleAnimation();

posted on 2015-03-26 13:49  wasdchenhao  阅读(757)  评论(0)    收藏  举报

导航