I am currently using my own layout for my MenuItem:

Main code:
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/menu_custom" android:actionLayout="@layout/menu_layout" android:showAsAction="always"/> </menu>
While the icon size in a pixel is described in Android Design and Guidelines, I have no idea about the margins, fill, width, and height that I should use for this icon, so it will look legal on all devices.
My current layout is:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/searchProgressWrapper" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageButton android:id="@+id/ivfolder" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_gravity="center" android:scaleType="fitCenter" android:background="@drawable/abs__item_background_holo_dark" android:src="@drawable/ic_menu_archive" /> </RelativeLayout>
The big problem is that, as you can see, the width of the icon is completely incorrect and not at all like other MenuItems.
source share