我已经实现了导航抽屉,我想在导航抽屉关闭之前加载我的片段.目前,片段与抽屉关闭并行加载,因此如果片段很重,则用户界面会挂起一点.
我的代码是:
private class DrawerItemClickListener implements ListView.OnItemClickListener { @Override public void onItemClick(AdapterView<?> parent,View view,int position,long id) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.content_frame,fragmentProfile); ft.commit(); drawerLayout.closeDrawer(drawerNaviListView); } }