title: How To Center Icon in Android Action Bar
body: <p>I'm trying to center the icon in the android action bar.  I'm using a custom layout that has a button on the left side, an icon in the center and the menu options on the right.  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/ActionBarWrapper"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
  
  
          &lt;ImageButton
              android:id="@+id/slideMenuButton"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:src="@drawable/ic_menu_bookmark" /&gt;
  
          &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/RelativeLayout1"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              android:layout_centerInParent="true"  &gt;
              &lt;ImageView
                  android:id="@+id/icon"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:src="@drawable/ic_launcher"
                  android:layout_centerInParent="true" /&gt;
          &lt;/RelativeLayout&gt;
  
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I've tried this with and without the RelativeLayout wrapping the ImageView.  The left button shows up fine, and I can set the icon with layout_toRightOf, but I can't get it to center.  Anyone have any ideas?</p>
  
  <p>Edit:
  Here's the android code in the on create method.</p>
  
  <pre><code>ActionBar actionBar = getSupportActionBar();
      actionBar.setDisplayShowTitleEnabled(false);
      actionBar.setDisplayUseLogoEnabled(false);
      actionBar.setDisplayHomeAsUpEnabled(false);
      actionBar.setDisplayShowCustomEnabled(true);
      actionBar.setDisplayShowHomeEnabled(false);
      actionBar.setDisplayOptions(actionBar.DISPLAY_SHOW_CUSTOM);
      View cView = getLayoutInflater().inflate(R.layout.actionbar, null);
      actionBar.setCustomView(cView);
  </code></pre>