i am customizing my Action bar using styles. I am using custom style and setting it to the application tag in manifest.
<style name="AppBaseTheme" parent="@style/Theme.AppCompat">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
<item name="android:titleTextStyle">@style/action_bar_title_text</item>
<item name="android:background">@drawable/cross_pattern</item>
</style>
<style name="action_bar_title_text">
<item name="android:textColor">@color/action_bar_title_text_color</item>
<item name="android:textSize">@dimen/action_bar_title_text_size</item>
<item name="android:gravity">center</item>
</style>
I am setting the title in the action bar also. Is there any way to center align the text ?
The issue is that i know how to do it via custom views, but i have to do it by styles.
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.
Instead of answers , my question is only getting downvoted.