DrawerLayout's item click - When is the right time to replace fragment?

后端 未结 7 783
轻奢々
轻奢々 2020-12-07 11:16

I\'m developing an application which uses the navigation drawer pattern (With DrawerLayout).

Each click on a drawer\'s item, replaces the fragment in the main contai

7条回答
  •  春和景丽
    2020-12-07 11:54

    If you want it smooth and without any delay, leave the drawer open and close it afterwards when returning (in the onRestart() method).

    @Override
    protected void onRestart() {
        // TODO Auto-generated method stub
        super.onRestart();
        mDrawerLayout.closeDrawer(mDrawerList);     
    }
    

    The side effect is an (speedy) animation when returning, but this might be acceptable.

提交回复
热议问题