Move ImageView from one layout to another

This one is pretty complicated, so naked with me, if it sounds a little awkward.

As you see below, I have an image before and after. In the first case, I have a toolbar that gets pumped through mine BaseActivity. Below the toolbar, I am inflating Fragmentwith ImageViewbelow actions. Therefore, to clear, I have a fragment with a picture that is pumped up under the action. The operation itself processes the toolbar, which is located above the specified fragment.

Before

Before

After the animation, I want the ImageView to go from ImageViewinside mine Fragmentto ImageViewmine Toolbar. (1)

After

After

The animation itself will resize and move to the toolbar (as shown in the "After" ).

The problem is that I don’t know how to move ImageViewfrom one layout to another. (2)

Question

(1). Is it possible to do this?

(2). Is there a way to "detach" ImageView from its parent to another layout?

Conclusion

So last time. I want to transfer my ImageView from a fragment to the Events toolbar.

I can imagine two ways to do this:

  • We send the ImageView from Fragment to Activity, after which we start the animation from its original position on the toolbar.

  • ImageView , ( ?), , .

+4

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


All Articles