Android: animation on layout after button clicked for minimum SDK version of 14
Asked Answered
R

4

5

How can I do exactly the same effect as this in Android in minimum SDK version 14 application?

enter image description here

  • Background effect
  • slide toggle button
  • my minSDKVersion is 14

Is looks like a circle enlarging animation on background, or is there a more specific function for it?

many thanks...

Rouge answered 24/11, 2015 at 4:28 Comment(2)
Do not redirect if you have image as example. :) Post in question only.Jacquelyn
Thanks for remind I never notice I can do that ""Rouge
J
4

Have a look Circular Reveal from touch point:

@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
    if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
        if (view.getId() == R.id.square_yellow) {
            revealFromCoordinates(motionEvent.getRawX(), motionEvent.getRawY());
        }
    }
    return false;
}

private Animator animateRevealColorFromCoordinates(int x, int y) {
    float finalRadius = (float) Math.hypot(viewRoot.getWidth(), viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, x, y, 0, finalRadius);
    viewRoot.setBackgroundColor(color);
    anim.start();
}

enter image description here

Jacquelyn answered 24/11, 2015 at 5:27 Comment(0)
M
1

I don't have concrete examples for exactly what you display in your example, however here are some examples that you can use to get close:

You can use a simple ToggleButton for the switch. See here: http://developer.android.com/guide/topics/ui/controls/togglebutton.html

For the ripple animation, take a look at this post: https://mcmap.net/q/27112/-how-to-achieve-ripple-animation-using-support-library There are several examples there which display a "ripple" effect. You could easily reuse this animation, decrease the opacity and set the animation to the background of the bigger views as shown in your example.

Hope this helps!

Moonraker answered 24/11, 2015 at 4:40 Comment(0)
P
1

You can refer to this library Material Animation library for implementing background reveal animation and Toggle Button library for checkbox animations.

Pawsner answered 24/11, 2015 at 4:45 Comment(0)
H
1

For anyone that is interested, I went ahead and created a demo app to demonstrate this effect using circular reveal from two switches. You can download it here. It's API 21 and above however.

https://github.com/o4wcoder/CircularRevealDemo

Homomorphism answered 21/7, 2016 at 19:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.