OK, So I understand how to use the include tag but I've run into a problem.
Basically I want to have a layout defined in xml which has a couple of TextView
s and an ImageView
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 LinearLayout
in this way as the TextView
s and ImageView
s within it have a constant id and I need to make multiple copies of this layout.
Is there any way to inflate a resource and then make a copy of it, that would work... So
LinearLayout one = new LinearLayout(inflater.inflate(R.layout.home, container, false));
^ There is no constructor like that unfortunately.
The only other way is to do it all programatically but I would of preferred to have the properties of the views and the LinearLayout
in xml rather than in the code. It's like I want the LinearLayout
to be a template which you can make copies of I guess... Really not sure if that's possible.