Navigation drawer doesn't close

后端 未结 11 956
暖寄归人
暖寄归人 2021-02-08 03:44

The navigation drawer in my app is not closing. I am using activities instead of fragments. When i click on any item in the listview, it opens other activities as i

11条回答
  •  梦毁少年i
    2021-02-08 04:31

    Here is the code: Lets say you have the drawer class

    in your activity call the class as and make a vaiable and assign it(put the drawer layout within a fragment for smoother user experience)

    Drawer drawer;
    drawer = (Drawer)getActivity().getSupportFragmentManager().findFragmentById(R.id.theid);
    drawer.mDrawerLayout.closeDrawer(Gravity.END);
    //End for right and Start for left
    

    Hope it helps

提交回复
热议问题