title: center align Android Action bar
body: <p>I'm having trouble center-aligning my logo and text for an android project. Here is my styles.xml:</p>
  
  <pre><code>&lt;resources
      xmlns:android="http://schemas.android.com/apk/res/android"
      &gt;
  
      &lt;!-- Actionbar style --&gt;
      &lt;style name="Widget.project.ActionBar" parent="Widget.Sherlock.Light.ActionBar"&gt;
          &lt;item name="titleTextStyle"&gt;@style/Widget.Elmwood.TitleTextStyle&lt;/item&gt;
          &lt;item name="android:titleTextStyle"&gt;@style/Widget.Elmwood.TitleTextStyle&lt;/item&gt;
  
          &lt;item name="android:background"&gt;@color/project_blue&lt;/item&gt;
          &lt;item name="background"&gt;@color/project_blue&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="Widget.Elmwood.TitleTextStyle" parent="TextAppearance.Sherlock.Widget.ActionBar.Title"&gt;
          &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;!--
          Base application theme, dependent on API level. This theme is replaced
          by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
      --&gt;
      &lt;style name="AppBaseTheme" parent="@style/Theme.Sherlock.Light.DarkActionBar"&gt;
  
          &lt;!--
              Theme customizations available in newer API levels can go in
              res/values-vXX/styles.xml, while customizations related to
              backward-compatibility can go here.
          --&gt;
  
      &lt;/style&gt;
  
      &lt;!-- Application theme. --&gt;
      &lt;style name="AppTheme" parent="AppBaseTheme"&gt;
          &lt;item name="actionBarStyle"&gt;@style/Widget.project.ActionBar&lt;/item&gt;
          &lt;item name="android:actionBarStyle"&gt;@style/Widget.project.ActionBar&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;!-- Buttons --&gt;
      &lt;style name="BlueBackgroundButtonLargeWhiteTextButton" parent="@android:style/Widget.Button"&gt;
          &lt;item name="android:background"&gt;@color/project_blue&lt;/item&gt;
          &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt;
          &lt;item name="android:textSize"&gt;@dimen/title_text&lt;/item&gt;
          &lt;item name="android:padding"&gt;@dimen/title_text_padding&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="InnerCircleDetailButton" parent="@android:style/Widget.Button"&gt;
          &lt;item name="android:background"&gt;@drawable/inner_circle_button&lt;/item&gt;
          &lt;item name="android:textSize"&gt;14dp&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="InnerCircleContinueButton" parent="@android:style/Widget.Button"&gt;
          &lt;item name="android:background"&gt;@drawable/black_grey_button_background&lt;/item&gt;
          &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt;
          &lt;item name="android:textSize"&gt;@dimen/normal_text&lt;/item&gt;
          &lt;item name="android:padding"&gt;5dp&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="HomepageButton" parent="@android:style/Widget.Button"&gt;
          &lt;item name="android:textSize"&gt;@dimen/title_text&lt;/item&gt;
          &lt;item name="android:layout_centerInParent"&gt;true&lt;/item&gt;
          &lt;item name="android:background"&gt;@null&lt;/item&gt;
      &lt;/style&gt;
      &lt;!-- end Buttons --&gt;
  
      &lt;!-- ListViews --&gt;
      &lt;style name="projectBlueListView" parent="@android:style/Widget.ListView"&gt;
          &lt;item name="android:cacheColorHint"&gt;@android:color/transparent&lt;/item&gt;
          &lt;item name="android:background"&gt;@color/project_blue_transparent&lt;/item&gt;
          &lt;item name="android:divider"&gt;@null&lt;/item&gt;
          &lt;item name="android:dividerHeight"&gt;0px&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="StandardListView" parent="@android:style/Widget.ListView"&gt;
          &lt;item name="android:cacheColorHint"&gt;@android:color/transparent&lt;/item&gt;
          &lt;item name="android:divider"&gt;@null&lt;/item&gt;
          &lt;item name="android:dividerHeight"&gt;0px&lt;/item&gt;
          &lt;item name="android:listSelector"&gt;@android:color/transparent&lt;/item&gt;
      &lt;/style&gt;
      &lt;!-- end ListViews --&gt;
  
      &lt;!-- TextViews --&gt;
      &lt;style name="TitleTextView" parent="@android:style/Widget.TextView"&gt;
          &lt;item name="android:textSize"&gt;@dimen/title_text&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="TitleTextViewWhite" parent="@style/TitleTextView"&gt;
          &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="NormalTextView" parent="@android:style/Widget.TextView"&gt;
          &lt;item name="android:textSize"&gt;@dimen/normal_text&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="NormalTextViewBold" parent="@style/NormalTextView"&gt;
          &lt;item name="android:textStyle"&gt;bold&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="NormalTextViewWhite" parent="@style/NormalTextView"&gt;
          &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="NormalTextViewGrey" parent="@style/NormalTextView"&gt;
          &lt;item name="android:textColor"&gt;@color/project_grey&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="projectListItemTitleTextView" parent="@style/NormalTextView"&gt;
          &lt;item name="android:textColor"&gt;@color/white&lt;/item&gt;
          &lt;item name="android:textSize"&gt;16dp&lt;/item&gt;
      &lt;/style&gt;
  
      &lt;style name="projectListItemNumberTextView" parent="@style/NormalTextView"&gt;
          &lt;item name="android:textColor"&gt;@color/project_grey&lt;/item&gt;
          &lt;item name="android:textSize"&gt;30dp&lt;/item&gt;
      &lt;/style&gt;
      &lt;!-- end TextViews --&gt;
  
  
  &lt;/resources&gt;
  </code></pre>
  
  <p>I can do <em>some</em> modifications; For instance if I remove</p>
  
  <pre><code>&lt;item name="android:background"&gt;@color/project_blue&lt;/item&gt;
  &lt;item name="background"&gt;@color/project_blue&lt;/item&gt;
  </code></pre>
  
  <p>I get a plain white action bar, but nothing I do whatsoever will allow me to change the alignment of either the text or the logo. Both need to be center aligned.</p>
  
  <p>I've looked up multiple solutions to this problem and all of them say the same thing; I need to make a custom layout which to m knowledge I already have. No changes I make to any XML files will change the alignment whatsoever.</p>
  
  <p>Could someone point me in the right direction?</p>
  
  <p>Edit:</p>
  
  <p>I've already tried adding a custom action bar but it didn't work. While I can get it to appear, it won't respond to centre-alignment at all.</p>
  
  <p>This is in my onCreate():</p>
  
  <pre><code>getSupportActionBar().setDisplayShowTitleEnabled(false);
  getSupportActionBar().setDisplayUseLogoEnabled(false);
  getSupportActionBar().setDisplayHomeAsUpEnabled(false);
  getSupportActionBar().setDisplayShowCustomEnabled(true);
  getSupportActionBar().setDisplayShowHomeEnabled(false);
  getSupportActionBar().setDisplayOptions(getSupportActionBar().DISPLAY_SHOW_CUSTOM);
  getSupportActionBar().setCustomView(getLayoutInflater().inflate(R.layout.custom_layout, null));
  </code></pre>
  
  <p>and this is my custom_layout.xml:</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:layout_gravity="center"
      android:orientation="horizontal"
      &gt;
  
  &lt;ImageButton
      android:id="@+id/slideMenuButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/ic_launcher"
      android:layout_alignParentLeft="true" /&gt;
  
  &lt;ImageView
      android:id="@+id/icon"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/app_icon"
      android:layout_centerVertical="true"
      android:layout_centerInParent="true"  /&gt;
  
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I can change the icons and stuff so I know it is at least responing to changes, but attempting to align it results in nothing.</p>