Good day. I again have a question on the Drawer Layout, namely on the "Hamburger button". On one piece I have included the Navigation Drawer and the "Hamburger Button". When switching to the 2nd Fragment, I disable this button and turn on the Home Button:
toggle.setDrawerIndicatorEnabled(false); toggle.syncState(); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); setSupportActionBar(toolbar); When returning to the 1st Fragment, I disable the Home Button , and return the "Hamburger button." It appears, but stops responding. What is the problem? Here is the return code for the 1st fragment:
setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(false); getSupportActionBar().setHomeButtonEnabled(false); toggle.setDrawerIndicatorEnabled(true); drawerLayout.setDrawerListener(toggle); toggle.syncState(); drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); If you return to add "Hamburger button" full initialization:
toggle = new ActionBarDrawerToggle( this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawerLayout.setDrawerListener(toggle); toggle.syncState(); then the picture gets even weirder and more confusing. At the FIRST transition from the 1st fragment to the 2nd, in the 2nd fragment, the Home Button is shown correctly, when you return to the 1st fragment, the Navigation Drawer also works, but when you try to go AGAIN to the 2nd fragment, a Hamburger appears in TulBar button, instead of HomeButton'a (which was shown at the first transition). In general, I hope someone can understand my question and tell where the error is!