第一步
第二步:获取需要被添加控件的布局
第三步:获取需要添加的布局(控件)
第四步:添加到布局中
final LayoutInflater inflater = LayoutInflater.from(this);
第二步:获取需要被添加控件的布局
final LinearLayout lin = (LinearLayout) findViewById(R.id.LinearLayout01);
第三步:获取需要添加的布局(控件)
LinearLayout layout = (LinearLayout) inflater.inflate(
R.layout.listview, null).findViewById(R.id.layout);
第四步:添加到布局中
lin.removeAllViews();
lin.addView(layout);