What is the best way to insert a layout inside another layout at runtime. Specifically I have a FrameLayout that contains a ListView. This is defined in one mainlayout.xml file, and I have another layout file defining the header in header.xml.
1) How do I include the headerlayout.xml defined layout inside the definition of mainlayout.xml.(static case) ie without copying everything inside but referencing the other definition.
2) How could I dynamically add header layout into specific spot in mainlayout.xml at runtime?
I know about inflating and all that, just not sure how to attach it to the spot where I want it in the mainlayout. Since I am not including whole definition in mainlayout.xml how to I have a placeholder there and set it dynamically in the right spot after inflation. (dynamic case).
Static case. Inside your
mainlayout.xml:Another solution which ca be both static and dynamic is using ViewStub