//放置显示不同Activity的控件 private LinearLayout mainContentLayout;
private LocalActivityManager localActivityManager = null; mainContentLayout = (LinearLayout)findViewById(R.id.main_content); /*
* id为传入的唯一标识, activityClass为要打开的activity.class
* 必须继承ActivityGroup
*/
public void setContainerView(String id, Class<?> activityClass){
mainContentLayout.removeAllViews();
Intent intent = new Intent(MainActivity.this, activityClass);
localActivityManager = getLocalActivityManager();
mainContentLayout.addView(localActivityManager.startActivity(id, intent).getDecorView());
}