【发布时间】:2014-02-25 14:40:44
【问题描述】:
我有一个带有一些片段的导航抽屉项目,现在我想从菜单中调用一个活动。 片段被加载到框架布局中,并在带有事务的单击事件菜单上替换为新片段。 当我单击菜单项时,我调用此代码:
fragment = new HomeFragment();
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
现在如果我用这段代码调用一个活动:
Intent intent = new Intent(MainActivity.this, asd.class);
startActivity(intent);
该活动会覆盖整个导航抽屉,因为我不会用新活动将现有片段替换为 frame_container。
我该怎么做?谢谢!
【问题讨论】: