Trying to overlay a fragment on top of an existing layout

We created a certain activity in our application, now we wanted to create a page like a textbook, in which we will fill the screen with fictitious data and show users what is (they will click next to see each component)

What I thought was to use the fragment (in 4+ compatibility mode) and leave the current activity as it is, and if the user wants to see the tutorial, the user interface (with dummy data) will completely overlay the current user interface ... But it causes me problems.

I basically used this example to create what I have now;

http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentArgumentsSupport.html

When I do "fragment.replace ()", I can put the identifier of any linear layout that is below the top one, and it will actually replace the contents of this layout with fragments. But it does nothing when I use the top linear layout. Therefore, I thought that I would try to put the top line layout in another line layout, for example, a container, and try to change it again, but it is surprising that it did not work. I have been with him for several hours, and I can't seem to figure it out.

Hope someone can help.

+4
source share
1 answer

Make the target location of FrameLayout instead of LinearLayout .

+7
source

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


All Articles