Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the merge tag for a RelativeLayout root?

I have a custom view which extends RelativeLayout and has its content defined in a xml file (has RelativeLayout as its root).

How can I avoid having two RelativeLayouts after the inflation of my custom layout? I tried using the merge tag as my root at the xml, but that way I'm losing all my child views structure.

like image 761
Daniel L. Avatar asked Jan 17 '26 17:01

Daniel L.


1 Answers

I tried using the merge tag as my root at the xml, but that way I'm losing all my child views structure.

I doubt that. The merge tag works with no problems, you just need to use the merge tag as the root of the layout file and assign the proper rules for the children in that layout. In the Eclipse's graphical editor this layout will not work(the rules will be ignored(quite normal as the editor doesn't know you'll use that layout as the content of a RelativeLayout)) but on an emulator/real device the rules will be applied.

If you have a sample application where the rules don't work with a merge tag don't be afraid to post it.

like image 59
user Avatar answered Jan 20 '26 09:01

user