Open top menu

Water Ripple Animation in Android

In this blog implement water ripple animation .explain the code...

In this blog used some extra xml and java class.click here

Step 1. In this class you can set the RippleBackground class attrs accordingly.
activity_main.xml.
...................................................................................................................................................................

 <RelativeLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/ScrollView1"
            android:background="#4b70dd"
             >

            <com.webnetware.view.RippleBackground
                xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:id="@+id/content"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="-4dip"
                app:rb_color="#a9d3ec"
                app:rb_duration="3000"
                app:rb_radius="64dp"
                app:rb_rippleAmount="7"
                app:rb_scale="14" >

                 

                <ImageView
                    android:id="@+id/imageView"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:contentDescription="@null"
                    android:src="@drawable/forword_arrow" />
            </com.webnetware.view.RippleBackground>
        </RelativeLayout>

...................................................................................................................................................................

MainActivity.java.
..................................................................................................................................................................

import java.util.ArrayList;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.ImageView;

import com.webnetware.singingbowl.R;
import com.webnetware.view.RippleBackground;

public class Splash_ScreenActivity extends Activity{
 RippleBackground rippleBackground;
 ImageView image;
private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
 
super.onCreate(savedInstanceState);
setContentView(R.layout.term_and_activity);
rippleBackground=(RippleBackground)findViewById(R.id.content);
image = (ImageView) findViewById(R.id.imageView);
rippleBackground.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {

rippleBackground.startRippleAnimation();
foundDevice(image);
}
});
...................................................................................................................................................................

Open first Screen.


Start the animation ,when you click on layout.





0 comments