How can I turn makeSceneTransitionAnimation into a circle, not a rectangle?

I'm currently trying to create a circular transition between my FAB and another action.

From what I understood in the documentation, I should use makeSceneTransitionAnimation just like this:

public void onFabClicked(View v){ try { Intent intent = new Intent(this, SearchActivity.class); ActivityOptions options = ActivityOptions .makeSceneTransitionAnimation(this, v, "reveal"); startActivity(intent, options.toBundle()); } catch (Exception e) { // makeSceneTransitionAnimation not supported, maybe a check of SDK level is enough to avoid catching an error? Intent intent = new Intent(this, SearchActivity.class); startActivity(intent); e.printStackTrace(); } } 

Unfortunately, the current animation displays a rectangle during the animation.

How can we turn this into a beautiful circular disclosure that we love at Lollipop?

Thanks.

EDIT:

I am trying to achieve this (except that the color should be fullscreen, but you get the point)): enter image description here

What I actually get:

enter image description here

+5
source share
1 answer

OK, I used this as an example: it works fine:

Github Code by saulmm

But .... Yes, it simply and works great, but in reality it is not the most effective way to achieve an effect. Adding an extra view to your layout and playing with visibility may not be the best way.

He had a lot of problems with the George Mount solution. But since this solution was written by a Google software engineer working in the Android UI Toolkit team and proposed by Alex, another Google engineer, I think I should spend more time with it, since it does not require additional presentation in my layout ...

The second one is a little more complicated for me, but will work on it.

In any case, the problem is solved.

+3
source

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


All Articles