Create circular reveal for pre-Lollipop devices (Android)

I find a library for you. Circular reveal, is compatible with 2.3 devices.

Hope it helps for you!!


Yes! you can use CircularReveal library : as @Alejandro said.

But you have to modify the library dependency to :

dependencies {
    compile 'com.github.ozodrukh:CircularReveal:1.1.1' //without "@aar" contrary to what the documentation says
}

If not, you'll get an Exception on some devices running on pre-lollipop version.


The best library is : CircularReveal

use :

Use regular RevealFrameLayout & RevealLinearLayout

<io.codetail.widget.RevealFrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Put more views here if you want, it's stock frame layout  -->

    <android.support.v7.widget.CardView
...
        />

</io.codetail.widget.RevealFrameLayout>

and :

  View myView = findView(R.id.awesome_card);

    // get the center for the clipping circle
    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;

    // get the final radius for the clipping circle
    int finalRadius = Math.max(myView.getWidth(), myView.getHeight());

    SupportAnimator animator =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(1500);
    animator.start();

This library is simple and works very nice in pre lollipop.


This is an update to Alejandro's and BadYous's answers.

  1. Best library is still Circular Reveal.

  2. The right description is implementation 'com.github.ozodrukh:CircularReveal:2.0.1'

  3. Use the right import for ViewAnimationUtils

     import io.codetail.animation.ViewAnimationUtils;