title: How to Center Text in Action bar Android?
body: <p>i am customizing my Action bar using styles. I am using custom style and setting it to the application tag in manifest. </p>
  
  <pre><code>&lt;style name="AppBaseTheme" parent="@style/Theme.AppCompat"&gt;
      &lt;item name="android:actionBarStyle"&gt;@style/MyActionBar&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar"&gt;
      &lt;item name="android:titleTextStyle"&gt;@style/action_bar_title_text&lt;/item&gt;
      &lt;item name="android:background"&gt;@drawable/cross_pattern&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="action_bar_title_text"&gt;
      &lt;item name="android:textColor"&gt;@color/action_bar_title_text_color&lt;/item&gt;
      &lt;item name="android:textSize"&gt;@dimen/action_bar_title_text_size&lt;/item&gt;
      &lt;item name="android:gravity"&gt;center&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>I am setting the title in the action bar also. Is there any way to center align the text ?</p>
  
  <p>The issue is that i know how to do it via custom views, but i have to do it by styles.</p>
  
  <p>I really don't understand the reason for downvoting. I thought that if you can change background style of action bar using custom style's so i thought that maybe you can align the text in Action bar to center. I have tried it myself first, but i was unsuccessful so  i asked it here then i asked question here. I think it is a good question.</p>
  
  <p>Instead of answers , my question is only getting downvoted.</p>