You can also do this using xml menu and style files. For example, to add a settings button, you can simply add an item to the menu file that defines the menu of the user interface shown in the picture. There are several predefined icons, such as the one I used (ic_menu_preferences), but you can use a different one or use an image instead. So in, say, agrippa_menu.xml:
<?xml version="1.0" encoding="utf-8"?>
[...]
<item android:id="@+id/menu_item_settings" android:title="@string/settings" android:icon="@android:drawable/ic_menu_preferences" android:showAsAction="ifRoom|withText" app:showAsAction="ifRoom|withText"/>
[...]
To disable the icon, you can add this line to the style that defines this user interface, or create a new one if you have not already created it. So in styles.xml:
<style name="AgrippaTheme" parent="android:Theme.Holo.Light"> <item name="logo">@color/transparent</item> <item name="android:logo">@color/transparent</item> </style>
Finally, referring to the heading in the middle, I did not find any other way, besides defining a custom xml action bar, and programmatically adjust it as it says here: Center Align the heading in the action bar using styles in android. :. If someone knows how to do this using only styles, would be welcome.
Albertoc
source share