Android layout load sub layouts
I want to make my xml layout more modular beca开发者_高级运维use this one is going to be pretty intricate!
I want some pieces to be in their own xml files. How would I reference them properly in the main XML file.
for instance
Lets say I have a
<relative layout>
<linear layout>
<relative layout>
<frame layout>
<relative layout>
<linear layout>
but the <frame layout>
has a very complex child, with columns containing buttons and scrollviews which contain listviews.
I would like to develop the frame layout in its own XML and then merely reference that xml document within my main one
what would the syntax for that look like? is it solely related to the ID that assign to <frame layout>
within my main XML?
The article Layout Tricks: Merging Layouts describes the <merge>
and the <include>
tag for layout xml files.
With <include>
you can reference an other layout and <merge>
can help to make your view hierarchy flatter.
精彩评论