title: AppCompat SupportActionBar problems regarding image placement
body: <p>I have a problem. I have a support action bar, in which i have set an image. The problem is that the image is slightly to the right. I think it's an compatibility problem.</p>
  
  <p>Here is the screenshot of the image:<img src="https://i.stack.imgur.com/MLtJp.png" alt="screenshot"></p>
  
  <p>As you can see, the image in the actionBar is slightly to the right(if it is not visible, believe me it is).</p>
  
  <p>The image was initially correctly centered, when i was using actionBar, but when i added appcompat to the project, getActionBar() started returning null, and the application crashed. I searched the internet and got to the getSupportActionBar() method. This time the application was not crashing, but the image is not centered correctly as before. I suspect it is a matter of theme/compatibility/overriding, or things like that.</p>
  
  <p>Can anyone help me?</p>
  
  <p>Here is the method in which i invoke the action bar:</p>
  
  <pre><code> public void initializeActionBar() {
      getSupportActionBar();
      getSupportActionBar().setDisplayShowCustomEnabled(true);
      getSupportActionBar().setCustomView(com.entu.bocterapp.R.layout.action_bar_center_image);
      getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xff50aaf1));
      getSupportActionBar().setDisplayShowTitleEnabled(false);
  }
  </code></pre>
  
  <p>Here is the XML for "R.layout.action_bar_center_image":</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="horizontal"&gt;
  &lt;ImageView
      android:id="@+id/bocterAppLogo"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:src="@drawable/bocterapp"
      android:contentDescription=""/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Here is the gradle.build:</p>
  
  <pre><code>buildscript {
  repositories {
      mavenCentral()
  }
  dependencies {
      classpath 'com.android.tools.build:gradle:1.0.0-rc1'
  }
  }
      apply plugin: 'android'
  
  dependencies {
      compile fileTree(include: '*.jar', dir: 'libs')
      compile files('libs/Parse-1.7.0/Parse-1.7.0.jar')
      compile 'com.android.support:appcompat-v7:21.0.3'
      compile 'com.google.android.gms:play-services:6.5.87'
  }
  android {
      signingConfigs {
          config {
              storeFile file('C:/bocterapp.keystore')
          }
      }
      compileSdkVersion 21
      buildToolsVersion '21.1.1'
      sourceSets {
      main {
          manifest.srcFile 'AndroidManifest.xml'
          java.srcDirs = ['src']
          resources.srcDirs = ['src']
          aidl.srcDirs = ['src']
          renderscript.srcDirs = ['src']
          res.srcDirs = ['res']
          assets.srcDirs = ['assets']
      }
  
      // Move the tests to tests/java, tests/res, etc...
      instrumentTest.setRoot('tests')
  
      // Move the build types to build-types/&lt;type&gt;
      // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
      // This moves them out of them default location under src/&lt;type&gt;/... which would
      // conflict with src/ being used by the main source set.
      // Adding new build types or product flavors should be accompanied
      // by a similar customization.
      debug.setRoot('build-types/debug')
      release.setRoot('build-types/release')
  }
  dexOptions {
      preDexLibraries = false
  }
  }
  </code></pre>
  
  <p>And here are the styles:</p>
  
  <p>styles:</p>
  
  <pre><code>&lt;resources xmlns:android="http://schemas.android.com/apk/res/android"&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="Theme.AppCompat.Light"&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;!-- All customizations that are NOT specific to a particular API-level can go here. --&gt;
  &lt;/style&gt;
  &lt;color name="azure"&gt;#50aaf1&lt;/color&gt;
  &lt;color name="black"&gt;#302D2D&lt;/color&gt;
  &lt;color name="white"&gt;#ffffff&lt;/color&gt;
  </code></pre>
  
  <p></p>
  
  <p>v11/:</p>
  
  <pre><code>&lt;resources&gt;
  
  &lt;!--
      Base application theme for API 11+. This theme completely replaces
      AppBaseTheme from res/values/styles.xml on API 11+ devices.
  --&gt;
  &lt;style name="AppBaseTheme" parent="Theme.AppCompat.Light"&gt;
      &lt;!-- API 11 theme customizations can go here. --&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p></p>
  
  <p>v14/:</p>
  
  <pre><code>&lt;resources&gt;
  
  &lt;!--
      Base application theme for API 14+. This theme completely replaces
      AppBaseTheme from BOTH res/values/styles.xml and
      res/values-v11/styles.xml on API 14+ devices.
  --&gt;
  &lt;style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar"&gt;
      &lt;!-- API 14 theme customizations can go here. --&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p></p>
  
  <p>Can someone be kind enough to help me?
  Cheers!</p>