Navigation drawer doesn't close

后端 未结 11 951
暖寄归人
暖寄归人 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条回答
  •  名媛妹妹
    2021-02-08 04:32

    I didn't see any code where you are closing the ListView from drawer... close the ListView Drawer on ListItem click...

        navList.setOnItemClickListener(new AdapterView.OnItemClickListener(){
            @Override
            public void onItemClick(AdapterView parent, View view, final int pos,long id){
                drawer.closeDrawer(navList);
                switch (pos){
                    case 0:
                        Intent i = new Intent(MainActivity.this,Aluminium.class);
                        startActivity(i);
                        break;
                    case 1:
                        Intent i2 = new Intent(MainActivity.this,Gold.class);
                        startActivity(i2);
                        break;
                    case 2:
                        Intent i3 = new Intent(MainActivity.this,Zinc.class);
                        startActivity(i3);
                        break;
                }
            }
        });
    

提交回复
热议问题