title: Need to make the list view on the vertically center for Drawer Layout in Android
body: <p>I have design a Drawer Layout which contains some options on a list(basically menu name and an icon). But i am not able to make the list view on the vertical center of the Drawer Layout. Here is my total xml layout:</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;!-- The main content view --&gt;
  
      &lt;LinearLayout
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/container"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:orientation="vertical" &gt;
  
          &lt;include
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              layout="@layout/header" /&gt;
  
          &lt;RelativeLayout
              xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/linearLayout1"
              android:layout_width="fill_parent"
              android:layout_height="40dp"
              android:background="@drawable/pink_header"
              android:orientation="horizontal"
              android:padding="5dip" &gt;
  
              &lt;TextView
                  android:id="@+id/tot_detail_title"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="5dp"
                  android:text="Talk of Town Details"
                  android:textColor="#222222"
                  android:textSize="14sp"
                  android:textStyle="bold"
                  android:typeface="sans" /&gt;
  
              &lt;LinearLayout
                  android:layout_width="fill_parent"
                  android:layout_height="match_parent"
                  android:layout_toRightOf="@id/feature_detail_title"
                  android:gravity="right"
                  android:orientation="horizontal" &gt;
  
                  &lt;Button
                      android:id="@+id/drawer_btn"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:background="@drawable/ic_drawer"
                      android:visibility="visible" /&gt;
  
  
              &lt;/LinearLayout&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;ScrollView
              android:layout_width="fill_parent"
              android:layout_height="wrap_content" &gt;
  
              &lt;LinearLayout
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical" &gt;
  
                  &lt;TextView
                      android:id="@+id/tot_title"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_gravity="center_horizontal"
                      android:layout_marginTop="5dp"
                      android:textColor="#222222"
                      android:textSize="18sp"
                      android:textStyle="bold"
                      android:typeface="sans" /&gt;
  
                  &lt;ImageView
                      android:id="@+id/image_tot_detail"
                      android:layout_width="fill_parent"
                      android:layout_height="200dp"
                      android:layout_gravity="center"
                      android:layout_marginTop="20dp"
                      android:background="@drawable/image_frame"
                      android:padding="1dip"
                      android:scaleType="fitXY" /&gt;
  
                  &lt;TextView
                      android:id="@+id/tot_time"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginLeft="10dp"
                      android:layout_marginTop="10dp"
                      android:textColor="#222222"
                      android:textSize="14sp"
                      android:textStyle="bold"
                      android:typeface="sans" /&gt;
  
                  &lt;TextView
                      android:id="@+id/tot_loc"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginLeft="10dp"
                      android:layout_marginRight="5dp"
                      android:textColor="#222222"
                      android:textSize="14sp"
                      android:textStyle="bold"
                      android:typeface="sans" /&gt;
  
                  &lt;TextView
                      android:id="@+id/tot_Desc"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginLeft="10dp"
                      android:layout_marginTop="10dp"
                      android:text="Description:"
                      android:textColor="#0C7DAF"
                      android:textSize="15sp"
                      android:textStyle="bold"
                      android:typeface="sans" /&gt;
  
                  &lt;TextView
                      android:id="@+id/tot_Desc_details"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_marginBottom="5dp"
                      android:layout_marginLeft="10dp"
                      android:layout_marginTop="10dp"
                      android:textColor="#222222"
                      android:textSize="15sp"
                      android:textStyle="bold"
                      android:typeface="sans" /&gt;
              &lt;/LinearLayout&gt;
          &lt;/ScrollView&gt;
      &lt;/LinearLayout&gt;
  
      &lt;FrameLayout
          android:id="@+id/content_frame"
          android:layout_width="match_parent"
          android:layout_height="fill_parent"
          &gt;
      &lt;/FrameLayout&gt;
      &lt;!-- The navigation drawer --&gt;
  
      &lt;ListView
          android:id="@+id/left_drawer"
          android:layout_width="240dp"
          android:layout_height="fill_parent"
          android:layout_gravity="left|center_vertical"
          android:choiceMode="singleChoice"
          android:background="#343434"
          android:dividerHeight="1dp"
          android:listSelector="@drawable/list_selector_drawer"
          android:divider="#ffffff"
           /&gt;
  
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p>Here is the drawer layout java code: </p>
  
  <pre><code> mTitle = mDrawerTitle = getTitle();
  
              // load slide menu items
              navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
  
              // nav drawer icons from resources
              navMenuIcons = getResources()
                      .obtainTypedArray(R.array.nav_drawer_icons);
  
              mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
              mDrawerList = (ListView) findViewById(R.id.left_drawer);
  
              navDrawerItems = new ArrayList&lt;NavDrawerItem&gt;();
  
              // adding nav drawer items to array
              // Home
              navDrawerItems.add(new NavDrawerItem(navMenuTitles[0], navMenuIcons.getResourceId(0, -1)));
              // Find People
              navDrawerItems.add(new NavDrawerItem(navMenuTitles[1], navMenuIcons.getResourceId(1, -1)));
              // Photos
              navDrawerItems.add(new NavDrawerItem(navMenuTitles[2], navMenuIcons.getResourceId(2, -1)));
  
              if(strTableBook.equals("yes"))
              {
                  // Table Booking
                  navDrawerItems.add(new NavDrawerItem(navMenuTitles[3], navMenuIcons.getResourceId(3, -1), true, "22"));
              }
  
              if(strGuestList.equals("yes"))
              {
                   // Guest List
                  navDrawerItems.add(new NavDrawerItem(navMenuTitles[4], navMenuIcons.getResourceId(4, -1)));
              }
  
              if(strBuyNow.equals("yes"))
              {
                  //Buy now
                  navDrawerItems.add(new NavDrawerItem(navMenuTitles[5], navMenuIcons.getResourceId(5, -1), true, "50+"));
              }
  
              Log.d("Testing", "here is 11111");
              // Recycle the typed array
              navMenuIcons.recycle();
  
              // setting the nav drawer list adapter
              adapter = new NavDrawerListAdapter(getApplicationContext(),
                      navDrawerItems);
              mDrawerList.setAdapter(adapter);
              mDrawerList.setOnItemClickListener(new SlideMenuClickListener());
              Log.d("Testing", "here is 22222");
  
              // enabling action bar app icon and behaving it as toggle button
  //          getActionBar().setDisplayHomeAsUpEnabled(true);
  //          getActionBar().setHomeButtonEnabled(true);
  
              Log.d("Testing", "here is 33333");
              mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
                      R.drawable.ic_drawer, //nav menu toggle icon
                      R.string.app_name, // nav drawer open - description for accessibility
                      R.string.app_name // nav drawer close - description for accessibility
              )
              {
                  public void onDrawerClosed(View view) {
  //                  getActionBar().setTitle(mTitle);
                      // calling onPrepareOptionsMenu() to show action bar icons
                      invalidateOptionsMenu();
                  }
  
                  public void onDrawerOpened(View drawerView) {
  //                  getActionBar().setTitle(mDrawerTitle);
                      // calling onPrepareOptionsMenu() to hide action bar icons
                      invalidateOptionsMenu();
                  }
              };
              Log.d("Testing", "here is 444444");
              mDrawerLayout.setDrawerListener(mDrawerToggle);
  </code></pre>
  
  <p>And here is the click event for the Drawer List Item:</p>
  
  <pre><code>/**
   * Slide menu item click listener
   * */
  private class SlideMenuClickListener implements
          ListView.OnItemClickListener {
  
      @Override
      public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position,
              long arg3) {
          // TODO Auto-generated method stub
          displayView(position);
          mDrawerLayout.closeDrawer(mDrawerList);
      }
  }
  </code></pre>
  
  <p>It is coming like this:</p>
  
  <p><img src="https://i.stack.imgur.com/98chA.png" alt="enter image description here"></p>
  
  <p>Can anyone help me to make it on center.</p>
  
  <p>Thanks..</p>