Android Question How to reduce height of items in overflow menu?

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Have a ACToolBarLight with some items in the overflow menu:

B4X:
Sub Activity_CreateMenu(Menu As ACMenu)
 
 Dim item As ACMenuItem
 
 Menu.Clear
 
 item = Menu.Add2(1, 1, " Find", TextToBitmapDrawable("F", 24, Colors.RGB(0, 0, 0)))
 item.ShowAsAction = item.SHOW_AS_ACTION_ALWAYS
 item = Menu.Add2(2, 2, " Pat", TextToBitmapDrawable("P", 24, Colors.RGB(0, 0, 255)))
 item.ShowAsAction = item.SHOW_AS_ACTION_ALWAYS
 item = Menu.Add2(3, 3, " Meds", TextToBitmapDrawable("M", 24, Colors.RGB(255, 0, 0)))
 item.ShowAsAction = item.SHOW_AS_ACTION_ALWAYS
 item = Menu.Add2(4, 4, " Vals", TextToBitmapDrawable("V", 24, Colors.RGB(0, 192, 0)))
 item.ShowAsAction = item.SHOW_AS_ACTION_ALWAYS
 
 'overflow menu (3 dots)
 '----------------------
 item = Menu.Add(5, 5, " Settings", Null)
 item = Menu.Add(6, 6, " SQL", Null)
 item = Menu.Add(7, 7, " Phone Patient", Null)
 item = Menu.Add(8, 8, " Text Patient", Null)

End Sub

The height of the items in the overflow menu is too large, so I am using space.
How can I reduce this height, so reducing the overall height of the overflow menu?


RBS
 

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Add this line to the style in the manifest editor:
B4X:
<item name="android:listPreferredItemHeightSmall">30dp</item>

Thanks, I tried that but doesn't make a difference.
This is my manifest file text:

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="26"/>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:supportsRtl, "true")

'End of default text.

SetApplicationAttribute(android:theme, "@style/MyAppTheme")

CreateResource(values, themes.xml,
<resources>
<dimen name="action_button_padding">0dp</dimen>
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">#FF9800</item>
        <item name="colorPrimaryDark">#F57C00</item>
        <item name="colorAccent">#FFA726</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
  <item name="windowActionModeOverlay">true</item>
  <item name="android:actionButtonStyle">@style/ActionButton</item>
    </style>
 <style name="ActionButton" parent="@android:style/Widget.ActionButton">
    <item name="android:paddingStart">0dp</item>
       <item name="android:paddingEnd">2dp</item>
       <item name="android:minWidth">2dp</item>
    <item name="android:listPreferredItemHeightSmall">10dp</item>
       <item name="android:drawablePadding">@dimen/action_button_padding</item>
   </style>
</resources>
)

Did I do something wrong in the manifest?

RBS
 
Upvote 0

RB Smissaert

Well-Known Member
Licensed User
Longtime User
Each thread should focus on a single question. The question about the menu items height was answered. If you have any other question then start a new thread and provide all the relevant information.

OK, no problem, will stick to that.

RBS
 
Upvote 0
Top