title: Nav Drawer Menu Android - Group of items listview
body: <p>I'm trying to do a navigator drawer menu in android and until now I did it:
  <img src="https://i.stack.imgur.com/Wvi1R.jpg" alt="enter image description here"></p>
  
  <p>But I want like a group of items like this edited image on paint:
  <img src="https://i.stack.imgur.com/kT78u.jpg" alt="enter image description here"></p>
  
  <p>How can I do it?
  How can divide some items?</p>
  
  <p>Thanks!</p>
  
  <p>Edit:</p>
  
  <p>navigation_drawer_base_layout.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.DrawerLayout          xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/drawer_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent" &gt;
  
  &lt;FrameLayout
      android:id="@+id/content_frame"
      android:layout_width="match_parent"
      android:layout_height="match_parent" /&gt;
  
  &lt;ListView
      android:id="@+id/nav_list"
      android:layout_width="@dimen/navigation_drawer_width"
      android:layout_height="match_parent"
      android:layout_gravity="start"
      android:background="@color/white"
      android:choiceMode="singleChoice" /&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>BaseActivity.java</p>
  
  <pre><code>package br.com.tokendev.mymoney;
  
  import java.util.ArrayList;
  
  import android.content.Context;
  import android.content.Intent;
  import android.content.res.Configuration;
  import android.os.Bundle;
  import android.support.v4.view.GravityCompat;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.app.ActionBarDrawerToggle;
  import android.view.KeyEvent;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.FrameLayout;
  import android.widget.ListView;
  
  /**
   * This activity will add Navigation Drawer for our application and all the code related to navigation drawer.
   * We are going to extend all our other activites from this BaseActivity so that every activity will have Navigation Drawer in it.
   * This activity layout contain one frame layout in which we will add our child activity layout.   
   */
  public class BaseActivity extends ActionBarActivity {
  
  /**
   *  Frame layout: Which is going to be used as parent layout for child activity layout.
   *  This layout is protected so that child activity can access this 
   *  */
  protected FrameLayout frameLayout;
  
  /**
   * ListView to add navigation drawer item in it.
   * We have made it protected to access it in child class. We will just use it in child class to make item selected according to activity opened. 
   */
  
  protected ListView mDrawerList;
  
  /**
   * List item array for navigation drawer items.
   * */
  protected String[] listArray;
  protected String[] listIconArray;
  
  /**
   * Static variable for selected item position. Which can be used in child activity to know which item is selected from the list. 
   * */
  protected static int position;
  
  /**
   *  Base layout node of this Activity.   
   * */
  protected DrawerLayout mDrawerLayout;
  
  /**
   * Drawer listner class for drawer open, close etc.
   */
  private ActionBarDrawerToggle actionBarDrawerToggle;
  
  private Context mContext;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.navigation_drawer_base_layout);
  
      mContext = this;
  
      frameLayout = (FrameLayout)findViewById(R.id.content_frame);
      mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
      mDrawerList = (ListView) findViewById(R.id.nav_list);
  
      listArray = getResources().getStringArray(R.array.menu_list);
      listIconArray = getResources().getStringArray(R.array.menu_list_icon);
      ArrayList&lt;NavDrawerMenu&gt; listMenu = new ArrayList&lt;NavDrawerMenu&gt;();
      for (int i=0; i&lt;listArray.length; i++) {
          listMenu.add(new NavDrawerMenu(listArray[i],getResources().getIdentifier(listIconArray[i], "drawable", this.getPackageName())));
      }
  
      // set a custom shadow that overlays the main content when the drawer opens
      mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
  
      // set up the drawer's list view with items and click listener
      ListViewDrawerMenu adapter = new ListViewDrawerMenu(mContext,
              R.layout.navigation_drawer_base_layout, listMenu);
      mDrawerList.setAdapter(adapter);
  
      //mDrawerList.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, listArray));
      mDrawerList.setOnItemClickListener(new OnItemClickListener() {
  
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                  int position, long id) {
  
              openActivity(position);
          }
      });
  
      // enable ActionBar app icon to behave as action to toggle nav drawer
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      getSupportActionBar().setHomeButtonEnabled(true);
  
      // ActionBarDrawerToggle ties together the the proper interactions between the sliding drawer and the action bar app icon
      actionBarDrawerToggle = new ActionBarDrawerToggle(
              this,                       /* host Activity */
              mDrawerLayout,              /* DrawerLayout object */
              R.string.app_name,       /* "open drawer" description for accessibility */
              R.string.app_name)      /* "close drawer" description for accessibility */
      {
          @Override
          public void onDrawerClosed(View drawerView) {
              super.onDrawerClosed(drawerView);
          }
  
          @Override
          public void onDrawerOpened(View drawerView) {
              super.onDrawerOpened(drawerView);
          }
  
          @Override
          public void onDrawerSlide(View drawerView, float slideOffset) {
              super.onDrawerSlide(drawerView, slideOffset);
          }
  
          @Override
          public void onDrawerStateChanged(int newState) {
              super.onDrawerStateChanged(newState);
          }
      };
  
      actionBarDrawerToggle.setDrawerIndicatorEnabled(true);
      mDrawerLayout.setDrawerListener(actionBarDrawerToggle);
  }
  
  @Override
  protected void onPostCreate(Bundle savedInstanceState) {
      super.onPostCreate(savedInstanceState);
      actionBarDrawerToggle.syncState();
  }
  
  @Override
  public void onConfigurationChanged(Configuration newConfig) {
      super.onConfigurationChanged(newConfig);
      actionBarDrawerToggle.onConfigurationChanged(newConfig);
  }
  
  /**
   * @param position
   *
   * Launching activity when any list item is clicked.
   */
  protected void openActivity(int position) {
  
      /**
       * We can set title &amp; itemChecked here but as this BaseActivity is parent for other activity,
       * So whenever any activity is going to launch this BaseActivity is also going to be called and
       * it will reset this value because of initialization in onCreate method.
       * So that we are setting this in child activity.   
       */
  
      mDrawerLayout.closeDrawer(mDrawerList);
      if (position == BaseActivity.position) return;
  
      if (BaseActivity.position != 0) finish();
  
      BaseActivity.position = position; //Setting currently selected position in this field so that it will be available in our child activities.
  
  
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
  
      getMenuInflater().inflate(R.menu.main, menu);
      return super.onCreateOptionsMenu(menu);
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
  
      // The action bar home/up action should open or close the drawer.
      // ActionBarDrawerToggle will take care of this.
      if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  
  /* We can override onBackPressed method to toggle navigation drawer*/
  @Override
  public void onBackPressed() {
      if (mDrawerLayout.isDrawerOpen(mDrawerList)) {
          mDrawerLayout.closeDrawer(mDrawerList);
      } else {
          BaseActivity.position = 0;
          super.onBackPressed();
      }
  }
  
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
      if (keyCode == KeyEvent.KEYCODE_MENU) {
  
          if (mDrawerLayout.isDrawerOpen(mDrawerList)) {
              mDrawerLayout.closeDrawer(mDrawerList);
          } else {
              mDrawerLayout.openDrawer(mDrawerList);
          }
  
          return true;
      }
      return super.onKeyDown(keyCode, event);
  }
  }
  </code></pre>