Clicking hamburger icon on Toolbar does not open Navigation Drawer

后端 未结 13 2874
太阳男子
太阳男子 2020-12-14 00:08

I have a simple android.support.v7.widget.Toolbar and all I am trying to do is to open a NavigationDrawer by pressing the \"hamburger\" icon in the top left cor

13条回答
  •  生来不讨喜
    2020-12-14 00:24

    Idk why...but changing return value to false rather than true fixed the ham Icon for me. on onOptionItemSelected override method

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        super.onOptionsItemSelected(item);
        if(item.getItemId() == R.id.logout){
            ParseUser.logOut();
            Intent intent = new Intent(getApplicationContext(), MainActivity.class);
            startActivity(intent);
            Toast.makeText(this, "Logout Successful!", Toast.LENGTH_SHORT).show();
        } else if(item.getItemId() == R.id.action_settings){
            Toast.makeText(this, "No setting to update! Will be available later...", Toast.LENGTH_SHORT).show();
        }
        return true; // here change this to false
    }
    

提交回复
热议问题