Create circular reveal for pre-Lollipop devices (Android)

前端 未结 7 2015
死守一世寂寞
死守一世寂寞 2020-12-15 03:35

Is it possible to get this new Animator for pre-Lollipop devices?

I am newbie and I am trying to get the java files from its official documentation, but I am really

相关标签:
7条回答
  • 2020-12-15 04:36

    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.

    0 讨论(0)
提交回复
热议问题