AppCompat v7 Toolbar onOptionsItemSelected not called

前端 未结 6 1782
感动是毒
感动是毒 2020-12-14 00:15

I changed from the original ActionBar to the AppCompat Toolbar and setSupportActionBar(toolbar). When I am using getSupportActionBar() and setDisplayHomeAsUpEnabled(true) fo

6条回答
  •  伪装坚强ぢ
    2020-12-14 00:41

    I had to implement an OnClickListener for the DrawerToggle:

    mDrawerToggle.setToolbarNavigationClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            popStackIfNeeded();
            mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
            mActionBar.setDisplayHomeAsUpEnabled(false);
            mDrawerToggle.setDrawerIndicatorEnabled(true);
        }
    });
    

    this fixed my issue.

提交回复
热议问题