How do I use the merge tag for the root of the RelativeLayout?

I have a custom view that extends RelativeLayout

and has its content defined in an XML file (has it RelativeLayout

as its root).

How can I avoid two RelativeLayouts

after inflation of my custom layout? I tried to use the tag merge

as my root in the xml, but by doing so I lose the whole structure of my child views.

+3


source to share


1 answer


I tried to use the merge tag as my root in xml, but this way I am losing all structure of my child views.

I doubt it. The tag merge

works seamlessly, you just need to use the tag merge

as the root of the layout file and assign the correct rules for the children in that layout. In the Eclipse graphical editor this layout will not work (the rules will be ignored (quite normal since the editor doesn't know that you will be using this layout as content RelativeLayout

)), but the rules will apply on the emulator / real device.



If you have a sample application where rules don't work with a tag merge

, feel free to post it.

+1


source







All Articles