[android]代码库
private void SwitchActivity(int position) {
linearLayout.removeAllViews();
Intent intent = null;
if (position == 0) {
} else if (position == 1) {
intent = new Intent(MainActivity.this, TwoActivity.class);
} else if (position == 2) {
intent = new Intent(MainActivity.this, ThreeActivity.class);
} else if (position == 3) {
intent = new Intent(MainActivity.this, FourMainActivity.class);
} else if (position == 4) {
intent = new Intent(MainActivity.this, FiveActivity.class);
}
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// Activity 转为 View
Window subActivity = getLocalActivityManager().startActivity(
"subActivity", intent);
// 容器添加View
linearLayout.addView(subActivity.getDecorView(),
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
}
by: 发表于:2017-10-24 09:19:37 顶(0) | 踩(0) 回复
??
回复评论