//1. Dynamically loading XML using Layoutinflater's inflateMlinearlayout =(LinearLayout) Findviewbyid (r.id.linearlayout_id); Layoutinflater Layoutinflater=Layoutinflater.from (context); View View= Layoutinflater.inflate (resource--needs to load the XML,NULL); Xml:resource= r.layout.xml-Name; Mlinearlayout.removeallviewsinlayout (); Removes the contents of the current LinearLayout Mlinearlayout.addview (view); Add XML to LinearLayout set width and Hight:LinearLayout.LayoutParams.FILL_PARENT, Mlinearlayout.getlayoutparams (). Width, etc. another: Mlinearlayout.addview (V,NewLinearlayout.layoutparams (Mlinearlayout.getlayoutparams (). Width, mlinearlayout.getlayoutparams (). height));//2. Loading XML with View.inflateSetcontentview (r.layout.layout_1); LinearLayout ll=(LinearLayout) Findviewbyid (r.id.box_1); View VV= View.inflate ( This, R.layout.layout_2,NULL); Ll.addview (VV,NewLinearlayout.layoutparams ll.getlayoutparams (). Width,ll.getlayoutparams (). height));