Skip to content Skip to sidebar Skip to footer

Resize Application Name In Action Bar

In my application I have 4 buttons in the Action Bar. I added android:showAsAction='always|withText' to each item in the xml file in order to force show all 4 of the icons. I am t

Solution 1:

According to this http://developer.android.com/design/patterns/actionbar.html (search for "How many actions will fit in the main action bar?") you should show but 2 actions on a 4" display. Of course you can show more actions but then you run into the problem you encountered. Also these recommendations are design guidelines and it makes sense to follow them to offer a good user experience. Having four buttons next to the title makes the action bar too crowded IMO.

I see a couple of options you can pursue:

  1. Use android:showAsAction="ifRoom|withText" instead of "always|withText"
  2. Use a split action bar to allow Android to show the actions at the bottom on the screen if there isn't enough space at the top. It would still show the actions at the top on tablet sized devices. See also http://developer.android.com/guide/topics/ui/actionbar.html#SplitBar
  3. Use a custom layout for your title to make the title smaller. I wouldn't recommend this because it would violate the design guidelines at least implicitly. If you still want to go down that path you need to create your own layout for the title using

    actionBar.setCustomView(newTitleBar, new ActionBar.LayoutParams(Gravity.LEFT))

To start with a custom layout just copy the one Android is using from your SDK folder.

Post a Comment for "Resize Application Name In Action Bar"