Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce space between menu items

Tags:

android

I have the following menu:

<menu xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:android="http://schemas.android.com/apk/res/android">


    <item
        android:title="@string/search_title"
        android:id="@+id/action_search_music"
        android:icon="@drawable/ic_add_final"

        app:actionViewClass="android.support.v7.widget.SearchView"
        app:showAsAction="ifRoom|collapseActionView" />

    <item
        android:id="@+id/more_options"
        android:title="Rename playlist"
        android:orderInCategory="101"
        app:showAsAction="always"
        android:icon="@drawable/ic_more_vert_black_24dp">

        <menu >
            <item android:id="@+id/rename_playlist"
                android:title="Rename playlist"
                >
            </item>
            <item android:id = "@+id/action_delete_playlist"
                android:title="Delete playlist"/>

        </menu>
    </item>
</menu>

Now, there is a pretty big space between the two menu items that I am unable to reduce. Are there any ideas how to reduce that space?

EDIT: The answer here: https://stackoverflow.com/a/10085862/6427401 doesn't work for me

like image 671
Itay Gutlansky Avatar asked Aug 24 '18 17:08

Itay Gutlansky


People also ask

How do I add a space to a menu in WordPress?

simple and immediate solution: add "&nbsp;" before and after the menu item.

How do I add a space between menus in Divi?

It can be enabled with the "Divi > Theme Customizer > Header & Navigation > Header Format > Enable Vertical Navigation" option. The default spacing is 19px, so anything bigger will increase it, while anything smaller will decrease it.


1 Answers

Add this to your app theme.

 <item name="android:actionButtonStyle">@style/ActionButtonStyle</item>

where ActionButtonStyle is

<style name="ActionButtonStyle" parent="Widget.AppCompat.ActionButton">
        <item name="android:minWidth">0dip</item>
        <item name="android:paddingStart">8dip</item>
        <item name="android:paddingEnd">8dip</item>
    </style>
like image 193
Rohit P Soman Avatar answered Nov 14 '22 13:11

Rohit P Soman