Thursday, 12 September 2013

how to start placement of action buttons from the left in action bar

how to start placement of action buttons from the left in action bar

I am new to android development. Hence, I'm still in the
getting-the-hang-of-it mode. I have started off my app by creating an xml
file in the res/menu folder, the code for which is shown below. What I
need help with is placing the first (add) button in the left hand corner,
where the title bar is supposed to be located, followed by the remove
button in the centre, and finally the overflow menu in the last third. I
want these three entities to be evenly spaced out. Additionally, I have
managed to get rid of the app name and icon from the left hand corner.
Any help will me much appreciated.
Thanks in advance
<?xml version="1.0" encoding="utf-8"?>
<item android:id="@+id/setting"
android:title="@string/action_settings"
android:orderInCategory="100"
android:showAsAction="never" />
<item android:id="@+id/add_contact"
android:title="@string/action_add"
android:orderInCategory="1"
android:showAsAction="ifRoom" />
<item android:id="@+id/remove_contact"
android:title="@string/action_remove"
android:orderInCategory="2"
android:showAsAction="ifRoom" />
This is what I want it to look like. It is a screen shot of the Nexus 4
contacts manager. However, I want buttons not tabs:
http://i.imgur.com/iDwUCJl.png
Current output: http://i.imgur.com/sQU3Jjq.png

No comments:

Post a Comment