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
  • 484,302
  • 314
  • 1,365
  • 1,393
unflagged.destination
  • 1,576
  • 3
  • 19
  • 38

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,334
  • 11
  • 56
  • 79