1

I am using below code to generate my action bar items -

<item
    android:id="@+id/action_home"
    android:icon="@drawable/icon_home"
    android:showAsAction="always"/>

<item
    android:id="@+id/action_favourite"
    android:icon="@drawable/icon_favourite"
    android:showAsAction="always"/>

<item
    android:id="@+id/action_notification"
    android:actionLayout="@layout/notification_badge"
    android:showAsAction="always"/>
    <item
    android:id="@+id/action_search"
    android:icon="@android:drawable/ic_menu_search"
    android:showAsAction="always"
    android:title="Search"/>

I want that these 4 items should be equally spaced in action bar, But they appear at top right in action bar. May be because of application title space in action bar. How can I give equal space between these four items?

Suragch
  • 428,106
  • 278
  • 1,284
  • 1,317
unflagged.destination
  • 1,536
  • 3
  • 17
  • 37

1 Answers1

1

That's the default behaviour which can't be changed AFAIK. But you can for example use an custom layout with all your buttons and then add it as a custom view to the action bar..

You can find useful details on that in this related question and answers.

Or you can build completely custom actionbar..But I would advice you to use the first solution.

Community
  • 1
  • 1
simekadam
  • 7,154
  • 11
  • 52
  • 77