public void replaceRightView(View v) {
int f = LinearLayout.LayoutParams.MATCH_PARENT;
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(f, f);
LinearLayout fragment_place = (LinearLayout) findViewById(R.id.fragment_place);
fragment_place.removeAllViews();
fragment_place.addView(v, params);
}Andorid类似Fragment替换布局方法,布布扣,bubuko.com
原文地址:http://blog.csdn.net/jay100500/article/details/25410083