You can do this using the LayoutInflater service. Get a link to it by downloading it as follows:
LayoutInflater inflater =
(LayoutInflater)this.getSystemService( Context.LAYOUT_INFLATER_SERVICE );
Then you can create the layout from the XML resource as follows:
View view = inflater.inflate( R.layout.layoutname, null );
layoutnamehere is just the name of the xml file in your directory res/layout.
, , addView.