Question

We are working on an Android application for industrial uses. We have increased the size of the action bar, text, etc to help improve visibility and touch target size. Everything works well, however I have been unable to increase the height of the action bar overflow menu's list items:

Action bar with small overflow menu items

Digging around I have been able to change the background colour of the popup menu using

    <style name="MyTheme" parent="@android:style/Theme.Holo">
        <item name="android:popupMenuStyle">@style/MyPopupMenu</item>
    </style>

    <style name="MyPopupMenu" parent="android:style/Widget.Holo.ListPopupWindow">
        <item name="android:popupBackground">#800</item>
    </style>

However there seems to be no way I can find to change the height of the menu items themselves. There are a lot of posts on stack overflow talking about customising spinners in the action bar, but very little about the action overflow menu.

Était-ce utile?

La solution

I actually just uncovered it while working on something else. The height of the items in the overflow action menu is controlled by the android:listPreferredItemHeightSmall item in the application theme. So:

<style name="MyTheme" parent="@android:style/Theme.Holo">
    <item name="android:listPreferredItemHeightSmall">72dp</item>
</style>

Gives us:

enter image description here

Changing android:listPreferredItemHeightSmall will possibly impact on some other things, but since in my case we are happy to have everything large, it works well.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top