Came up to the moment when it was time to start writing transitions from the items drawer to go to the necessary activations. But since self-taught and this is my first “combat” project, I’m going to search the network for implementation - and they use the practice from the listView everywhere.

At the moment I have only the following code:

  private void initNavigationDrawer() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); NavigationView navigationView = (NavigationView) findViewById(R.id.navigationView); drawer.closeDrawer(GravityCompat.START); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.open_drawer, R.string.close_drawer); // drawer.setDrawerListener(toggle); toggle.setHomeAsUpIndicator(R.drawable.hamburger); toggle.syncState(); navigationView.setNavigationItemSelectedListener(this); } 

and

  @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); switch (id) { case R.id.recent_activity: Intent intent = new Intent(this, RecentActivity.class); startActivity(intent); } return true; } 

At the same time, a new activation does not appear. To be more precise - it is obscured by an empty “barrier”.

The question is, is it only through the listView and the separate drawer handler drawer transition is made to the menu items, what are the pitfalls (when turning, maybe?), Is it worth using fragments or unnecessarily?

Some minimal code is desirable, without which any drawer will not do, minimal functionality.

  • And if at creation of intent to replace this with YourActivity.this ? - post_zeew
  • And this actviti is registered in the manifesto? - Yuriy SPb ♦
  • First, with a drawer, it's better to use fragments. Better yet, always use fragments. Secondly, Creating a Navigation Drawer , section "Handle Navigation Click Events". - Sergey Gornostaev
  • @ YuriySPb yes, spelled out - Silento

0