Android: How to dynamically include a XML Layout?
<RelativeLayout android:id="@+id/rl" ...
In your code:
// get your outer relative layoutRelativeLayout rl = (RelativeLayout) findById(R.id.rl);// inflate content layout and add it to the relative layout as second child// add as second child, therefore pass index 1 (0,1,...)LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); rl.addView(1, layoutInflater.inflate(R.layout.content_layout, this, false) );