I need to use part of my activity layout in fragmnent, but I dont know how. If I use overlaying FrameLayout, I will not have access to the elements behind it. And duplicate part of activity_main_layout in several fragments also is not good idea.

I need to use part of my activity layout in fragmnent, but I dont know how. If I use overlaying FrameLayout, I will not have access to the elements behind it. And duplicate part of activity_main_layout in several fragments also is not good idea.

A fragment can't host an activity. Instead you can use nested fragments for this purpose. Fragment Inside Fragment
It looks like i need to use fragments with transparent container in the middle