Android: animation on the layout after clicking a button for the minimum version of SDK 14

How can I make the same effect as in Android, in an application with a minimum SDK version 14?

enter image description here

  • Background effect
  • slide switch button
  • my minSDKVersion - 14

It looks like an increase in the circle in the background, or is there a more specific function for it?

many thanks...

+4
source share
4 answers

See Circular disclosure from the point of contact :

@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

+4
source

I have no concrete examples of what you show in your example, but here are a few examples that you can use to get closer:

ToggleButton . . : http://developer.android.com/guide/topics/ui/controls/togglebutton.html

: fooobar.com/questions/47769/... , "". , , .

, !

+1

.

+1

For everyone who is interested, I went ahead and created a demo application to demonstrate this effect using circular detection with two switches. You can download it here. However, API 21 and higher.

https://github.com/o4wcoder/CircularRevealDemo

+1
source

Source: https://habr.com/ru/post/1617170/


All Articles