title: Android using layouts as a template for creating multiple layout instances
body: <p>OK, So I understand how to use the include tag but I've run into a problem.</p>
  
  <p>Basically I want to have a layout defined in xml which has a couple of <code>TextView</code>s and an <code>ImageView</code> in it. I then want to iterate across an array and populate fields within the xml layout depending on whats in an array(which is populated on runtime). Thus making multiple copies of the xml layout and populating the fields with unique data. Now i've got no idea how you can re-use this <code>LinearLayout</code> in this way as the <code>TextView</code>s and <code>ImageView</code>s within it have a constant id and I need to make multiple copies of this layout.</p>
  
  <p>Is there any way to inflate a resource and then make a copy of it, that would work... So </p>
  
  <pre><code>LinearLayout one = new LinearLayout(inflater.inflate(R.layout.home, container, false));
  </code></pre>
  
  <p>^ There is no constructor like that unfortunately.</p>
  
  <p>The only other way is to do it all programatically but I would of preferred to have the properties of the views and the <code>LinearLayout</code> in xml rather than in the code. It's like I want the <code>LinearLayout</code> to be a template which you can make copies of I guess... Really not sure if that's possible.</p>